Take the 2-minute tour ×

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 the 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?


share|improve this question
add comment

1 Answer

Something like this should work. Where the 3 that multiplies Container.ItemIndex is the number of controls on the repeater template.

    <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:TextBox ID="TextBox2" runat="server" 
       TabIndex='<%# 3 + (Container.ItemIndex)*3 %>'></asp:TextBox>
share|improve this answer
add comment

Your Answer


