按钮点击不工作使用ASP.净c#
本文关键字:ASP 工作 按钮 | 更新日期: 2023-09-27 18:18:33
在本地工作正常,但当我在肝脏服务器上注册时,有些时候注册是重定向到成功页面,有些时候没有重定向,也没有得到任何错误消息。注册表格是非常大的,所以,我没有把所有的设计,代码,但我已经从每个块代码。根据我的面板是问题可能是,但另一件事我必须观察,如果页面不是注册,然后我重新加载相同的页面,然后填写所有的细节,然后它的提交。
页面加载代码:
BusinessLogic bl = new BusinessLogic();
BusinessObject bo = new BusinessObject();
protected void Page_Load(object sender, EventArgs e)
{
HtmlGenericControl body = (HtmlGenericControl)Master.FindControl("MasterpageID");
body.Attributes.Add("class", "fifth");
//to restore password field when page refreshes
txt_Password.Attributes.Add("value", txt_Password.Text);
}
设计代码:
Nationality:<asp:DropDownList ID="ddl_Nationality" runat="server" CssClass="dropdown" AppendDataBoundItems="true"
AutoPostBack="true" OnSelectedIndexChanged="ddl_Nationality_SelectedIndexChanged">
<asp:ListItem Text="Select" Value="0"></asp:ListItem>
<asp:ListItem Text="Indian" Value="Indian"></asp:ListItem>
<asp:ListItem Text="Expatriate" Value="Expatriate"></asp:ListItem>
</asp:DropDownList>
Title: <asp:DropDownList ID="ddl_Title" runat="server" CssClass="dropdown" AppendDataBoundItems="true">
<asp:ListItem Text="Select" Value="0"></asp:ListItem>
<asp:ListItem Text="Mr." Value="Mr."></asp:ListItem>
</asp:DropDownList>
Name: <asp:TextBox ID="txt_Name" runat="server" CssClass="textfield_new1" MaxLength="20"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpdatePanel3" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
Country: <asp:DropDownList ID="ddl_Country" runat="server" CssClass="dropdown">
<asp:ListItem Text="Select" Value="0"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<table>
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel5" runat="server" >
<ContentTemplate>
Total Experience: <asp:DropDownList ID="ddl_years" runat="server" AutoPostBack="true" CssClass="Exp"
OnSelectedIndexChanged="ddl_years_SelectedIndexChanged">
<asp:ListItem Value="0">Year</asp:ListItem>
<asp:ListItem Value="1">0</asp:ListItem>
<asp:ListItem Value="2">1</asp:ListItem>
<asp:ListItem Value="3">2</asp:ListItem>
<asp:ListItem Value="4">3</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddl_months" runat="server" CssClass="Exp"
Enabled="false">
<asp:ListItem Selected="True" Value="0">Month</asp:ListItem>
<asp:ListItem Value="1">0</asp:ListItem>
</asp:DropDownList>
</ContentTemplate>
</asp:UpdatePanel>
</td> </tr>
</table>
<table>
<tr>
<td>
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
<ContentTemplate>
<cc1:CaptchaControl ID="CaptchaControl1" runat="server" CaptchaBackgroundNoise="None"
CaptchaHeight="40" CaptchaLength="5" CaptchaLineNoise="None" CaptchaMaxTimeout="240"
CaptchaMinTimeout="5" FontColor="111, 109, 85" Width="325px" CaptchaWidth="300"
CssClass="textarea_captha" />
</ContentTemplate>
</asp:UpdatePanel>
</td></tr>
<tr><td>
Enter Text as you See:<asp:TextBox ID="txtCaptcha" runat="server" CssClass="textfield_new1"></asp:TextBox>
</td></tr>
</table>
<table>
<tr><td>
<asp:LinkButton ID="imgbtn_Submit" runat="server" ValidationGroup="reg" CssClass="submitbtn"
</td></tr>
</table>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="images/spacer.gif" />
<cc1:ModalPopupExtender ID="ModalPopupExtender1" TargetControlID="ImageButton1" PopupControlID="Pnl_popup1"
BackgroundCssClass="modalBackground" Drag="true" PopupDragHandleControlID="Pnl_popup1"
runat="server">
</cc1:ModalPopupExtender>
<asp:Panel ID="Pnl_popup1" runat="server">
//pop design code is here
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
您的更新面板在重定向中出现问题。请注意,更新面板仅用于AJAX请求。它将只发布选定的面板数据。所以当你想从一个页面重定向到另一个页面时,添加更新面板是没有意义的。
删除不必要的更新面板并尝试这样做。这会对你有帮助的。
add OnClick Event in your Button