Results 1 to 1 of 1
Feb 28, 2012, 08:49 #1
- Join Date
- Nov 2011
- 0 Post(s)
- 0 Thread(s)
Using TrackFocus(), keeping focus in TabContainer on PostBack
I've been scouring the internet and forums for days now trying to solve this issue, that seems to me like it should be pretty simple. Basically I have a multi-step form with multiple tabs in a TabContainer. There are a couple radiobuttonlists that perform autopostbacks, and I want to let the users focus go back on the radiobuttonlist so that they aren't sent back to the top of the page and lose their page state.
I have tried all of the usual stuff using SetFocus() on a control, or a certain item in the radiobuttonlist. Have used the .focus() command on every control as well as HiddenFields, and textboxes with visible="false" just to try to get the user back to that area of the page. Have also tried to set the focus to a button, all to no avail.
I'm beginning to think this is because they are located inside of a TabContainer and TabPanel, which still seems a little ridiculous to me. Everything I read keeps saying TrackFocus() has been implemented since .Net 2.0 but there is no documentation or implementation work for it anywhere. Does anyone have a suggestion for me how to approach this. I'll put up a little bit of code but basically it's in the Page_Load()
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not IsPostBack Then TabContainer1.ActiveTabIndex = 0 Else If radInqRel.SelectedIndex = 3 Then ModalPopupExtender1.Show() ElseIf radInqRel.SelectedIndex = 2 Then MoreInfo.Visible = False End If txtFocus.Focus() End If End Sub
Here's the radiobuttonlist code;
<asp:Panel runat="server"> <asp:RadioButtonList ID="radInqRel" OnSelectedIndexChanged="radInqRel_SelectedIndexChanged" runat="server" RepeatColumns="2" Width="500px" CssClass="style66" AutoPostBack="True"> <asp:ListItem>a. Patient - Self</asp:ListItem> <asp:ListItem>b. Family / Friend</asp:ListItem> <asp:ListItem>c. Clinician, McLean</asp:ListItem> <asp:ListItem>d. Clinician, outside McLean</asp:ListItem> <asp:ListItem>e. Other (e.g. Court, lawyer)</asp:ListItem> </asp:RadioButtonList> <asp:TextBox ID="txtFocus" runat="server" Visible = "False"></asp:TextBox> <asp:HiddenField ID="HiddenField1" runat="server" /> </asp:Panel>