0

Is there any way to manageme Submit buttons behaviour?

For example:

<form id="form1" runat="server">    
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>    
    <asp:UpdatePanel ID="up1" runat="server">
    <ContentTemplate>
        <asp:TextBox runat="server" ID="tb1" />
        <asp:Button runat="server" ID="btnSubmit1" UseSubmitBehavior="true" />
    </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="up2" runat="server">
    <ContentTemplate>
        <asp:TextBox runat="server" ID="tb2"> />
        <asp:Button runat="server" ID="btnSubmit2" UseSubmitBehavior="true" />
    </ContentTemplate>
    </asp:UpdatePanel>        
</form>

If we are on focus on "tb2", I wish that "btnSubmit2" will have control over "Submit" behaviour (e.g. pressing enter). we are on focus on "tb1", I wish that "btnSubmit1" will have control over "Submit" behaviour (e.g. pressing enter).

I presume it should be implemented in the ASP.NET infrastructure, and if not, what is the best way to implement management of Submit buttons behaviour in ASP.NET 3.5 or ASP.NET 4.0?

Thanks in advance.

2 Answers 2

2

Panels have the DefaultButton property, see MSDN. You could wrap your controls in a Panel, and set that property to the Button you want to submit the form by.

Sign up to request clarification or add additional context in comments.

1 Comment

my UpdatePanel needs a Panel, GREAT !
0

Use Panel control to wrap up the UI and set ButtonId to the DefaultButton attribute of each panel.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.