[英]Button click not working Using ASP.NET c#
在本地可以正常工作,但是當我在肝臟服務器上進行注冊時,有一段時間注冊會重定向到成功的頁面,有一段時間沒有重定向,也沒有收到任何錯誤消息。 注冊表很大,所以,我並沒有放置所有設計,代碼,而是從每個模塊中獲取了代碼。 根據我的說法,問題可能是,但是另一件事是我必須觀察該頁面是否未注冊,然后我再次重新加載同一頁面,然后填寫所有詳細信息然后提交。
頁面加載代碼:
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請求。 它將僅發布選定的面板數據。 因此,當您要從一個頁面重定向到另一頁面時,添加“更新”面板沒有任何意義。
刪除不必要的更新面板,然后嘗試做。 它會幫助你。
在按鈕中添加OnClick事件
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.