我对PHP有很多经验,但我正在尝试用ASP.NET实现一个站点
我有一个按钮,我希望通过更改文本来尝试测试。但是,即使所有字段都经过验证,我也没有收到任何响应。
这是我的cleint端代码
<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" />
这是C#
protected void FinishButton_Click(object sender, EventArgs e)
{
Finish.Text = "hello";
}
答案 0 :(得分:1)
好的,我找到了答案......
我添加了
UseSubmitBehavior="False"
答案 1 :(得分:0)
尝试AutoPostBack =“true”
<asp:Button ID="Finish" runat="server" Text="Finish" Height="30" Width="50" ValidationGroup="UserTypeInformation" OnClick="FinishButton_Click" AutoPostBack="true" />