I have an aspx form containing many individual controls like and one repeater control.
The repeater control items are basically having dropdowns, textboxes etc. next to each other.
My problem is I can set the tab index of each individual element easily but I don't know how to set the tab index of the first element in of the first repeater item.
That is why first I need to click 开发者_如何学Pythonthe item and then the Tab index inside the repeater control works fine.
Do you know how can I fix this?
Should I handle this on the server side? or jQuery etc?
Thanks
Something like this should work. Where the 3
that multiplies Container.ItemIndex
is the number of controls on the repeater template.
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"
TabIndex='<%# 1 + (Container.ItemIndex)*3 %>'></asp:TextBox>
<asp:DropDownList ID="DropDownList1" runat="server"
TabIndex='<%# 2 + (Container.ItemIndex)*3 %>'>
</asp:DropDownList>
<asp:TextBox ID="TextBox2" runat="server"
TabIndex='<%# 3 + (Container.ItemIndex)*3 %>'></asp:TextBox>
</ItemTemplate>
</asp:Repeater>
精彩评论