I have web form with a panel which has form elements in side it. and i have two radio button also based on the selection of radio button i want to change the DefaultButton property of panel1 control to another like “btnASWebPages” based on which radio button is selected.
How i can change this property using jQuery. I have tried few option but didn’t seem to work.
<asp:Panel ID="Panel1" runat="server" DefaultButton="btnASArchive">
<div id="AdvancedSearchBox" class="AdvancedSearchBox">
<asp:Label ID="lblAdvancedSearch" CssClass="lblAdvancedSearch" runat="server" Text="SEARCH"></asp:Label>
<asp:TextBox ID="txtAdvancedSearch" CssClass="txtAdvancedSearch" runat="server"></asp:TextBox>
</div>
<div id="AdvanceSearchChoice" class="AdvanceSearchChoice">
<asp:RadioButton ID="rbSearchArchive" CssClass="rbSearchChoice" runat="server" Text="Articles Archive" GroupName="rdAdvanceSearchChoice" Checked="True" />
<asp:RadioButton ID="rbSearchPages" CssClass="rbSearchChoice" runat="server" Text="Web Pages" GroupName="rdAdvanceSearchChoice" />
</div>
</panel>
I have posted only related code for this issue as form is quite big to put all the code. Just to add more based on radiobutton selection i hide and unhide two different forms so that user can search in related area, But i have a problem where my client wants to activate search on enter key. in order to achive this i have to activate the default form related to radio button selection. For example if one select Archive option then archive form will be visible and vice versa.
When rendered in the browser, this…
become this….
You need to unbind the keypress event and create a new one. I think you’re going about this the wrong way and that it should be done on the server in postback events of the radio controls.