Ian McCullough
Ian McCullough

Reputation: 1443

Button click event not responding

I have had much experience with PHP but am trying to implement a site with ASP.NET

I have a button I wish to attempt to test by changing the text of. However, I am not getting any response even when all fields are validated.

Here is my cleint-side code

<strong>What mobile platform do you use?</strong><br />
            <asp:DropDownList ID="MobilePlatforms" runat="server">
                <asp:ListItem></asp:ListItem>
                <asp:ListItem Value="iOS">iOS (Apple)</asp:ListItem>
                <asp:ListItem Value="Android">Android</asp:ListItem>
                <asp:ListItem Value="Windows">Windows</asp:ListItem>
                <asp:ListItem Value="Blackberry">Blackberry</asp:ListItem>
            </asp:DropDownList>
            <asp:RequiredFieldValidator InitialValue="" ID="MobilePlatformsValidator" runat="server" ControlToValidate="MobilePlatforms" ErrorMessage="This field is required." ToolTip="This field is required." ValidationGroup="UserTypeInformation" ClientIDMode="Static"><font color="red">*</font></asp:RequiredFieldValidator>


            <div style="text-align:right">
            <asp:Button ID="Finish" runat="server" Text="Finish" Height="30" Width="50" ValidationGroup="UserTypeInformation" OnClick="FinishButton_Click" />

Here is the C#

protected void FinishButton_Click(object sender, EventArgs e)
        {
            Finish.Text = "hello";
        }

Upvotes: 0

Views: 643

Answers (2)

Ian McCullough
Ian McCullough

Reputation: 1443

Okay, I have found the answer.....

I have added

UseSubmitBehavior="False"

Upvotes: 1

Animal Style
Animal Style

Reputation: 709

Try AutoPostBack="true"

<asp:Button ID="Finish" runat="server" Text="Finish" Height="30" Width="50" ValidationGroup="UserTypeInformation" OnClick="FinishButton_Click" AutoPostBack="true" />

Upvotes: 0

Related Questions