部署后按钮单击事件 [英] Button Click Event after deployment

查看:50
本文介绍了部署后按钮单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个小型Web应用程序,该应用程序在本地计算机上运行良好,但是将站点部署到服务器后,所有其他按钮单击事件均正常运行,但一个按钮事件没有触发:

I have a small web application which is running well on my local machine but once I deploy my site to the server, all the other buttons click events are working except for one button event which is not firing:

public void checkpassword(object sender,EventArgs e)
   {

       string password = txtpassword.Text.ToString();
       SqlConnection con = new SqlConnection(connect);
       SqlCommand command = new SqlCommand("matchpassword",con);
       con.Open();
       command.CommandType = CommandType.StoredProcedure;

       SqlDataAdapter sqlDALogin1 = new SqlDataAdapter();
       DataSet sqlDSLogin1 = new DataSet();
       sqlDALogin1.SelectCommand = command;
       sqlDALogin1.Fill(sqlDSLogin1, "Password");

       string passwrd = Convert.ToString(sqlDSLogin1.Tables[0].Rows[0]["Password"]);
       con.Close();

       if (password == passwrd)
       {

       }
       else
       {
           //Response.Redirect("ViewRecords.aspx");
           lbldisplay.Text = "Wrong Password";
           panelpassword.Update();
           ModalPassword.Show();
       }

   }


<asp:Panel ID="Panel1" runat="server" CssClass="HellowWorldPopup2" Style="display:none">
             <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                 <ContentTemplate>

                     <asp:Button ID="BtnOK" runat="server" Text="OK" CssClass="lb-testright" OnClick="checkpassword"

                       />
                     <asp:Button ID="BtnCancel" runat="server" Text="Cancel" CssClass="lb-testleft" OnClick="redirecttorecords" />
                      <asp:Button ID="Button1" runat="server" Text="Cancel" Style="display:none" />
                     <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
                     <asp:TextBox ID="txtpassword" runat="server" CssClass="lb-textbox"

                         TextMode="Password" onfocus="clearContents(this);">Password </asp:TextBox>

             <asp:ModalPopupExtender ID="Modal_Password" runat="server"

               TargetControlID="Button1" PopupControlID="Panel1" DropShadow="true" >
             </asp:ModalPopupExtender>
             </ContentTemplate>
             </asp:UpdatePanel>
        </asp:Panel>



这在我的机器上可以正常工作,但在部署时无法正常工作.
谢谢



This is working fine on my machine but what doesn''t work when deployed.
Thanks

推荐答案


检查此asyncpostbacktrigger

Hi ,
Check this asyncpostbacktrigger

<asp:Panel ID="Panel1" runat="server" CssClass="HellowWorldPopup2" Style="display:none">
             <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                 <ContentTemplate>

                     <asp:Button ID="BtnOK" runat="server" Text="OK" CssClass="lb-testright" OnClick="checkpassword"

                       />
                     <asp:Button ID="BtnCancel" runat="server" Text="Cancel" CssClass="lb-testleft" OnClick="redirecttorecords" />
                      <asp:Button ID="Button1" runat="server" Text="Cancel" Style="display:none" />
                     <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
                     <asp:TextBox ID="txtpassword" runat="server" CssClass="lb-textbox"

                         TextMode="Password" onfocus="clearContents(this);">Password </asp:TextBox>

             <asp:ModalPopupExtender ID="Modal_Password" runat="server"

               TargetControlID="Button1" PopupControlID="Panel1" DropShadow="true" >
             </asp:ModalPopupExtender>
             </ContentTemplate>
 <triggers>  
                <asp:asyncpostbacktrigger controlid="BtnOK" eventname="Click" xmlns:asp="#unknown" />  
            </triggers>  
             </asp:UpdatePanel>
        </asp:Panel>



http://msdn.microsoft.com/en-us/library/system. web.ui.asyncpostbacktrigger.aspx [ ^ ]

http://asp-net-example.blogspot.com/2009/11/ajax-asyncpostbacktrigger-how-to-use.html [



http://msdn.microsoft.com/en-us/library/system.web.ui.asyncpostbacktrigger.aspx[^]

http://asp-net-example.blogspot.com/2009/11/ajax-asyncpostbacktrigger-how-to-use.html[^]
Best Regards
M.Mitwalli


感谢大家的贡献.解决该问题的方法是,我必须在sql服务器数据库存储过程中设置属性,并授予对public的访问执行访问权限.

再次感谢大家
Thanks everyone for your contributions. The solution to the issue was that I had to set the properties in the sql server database stored procedure and grant access execute access to the public

Thanks Again Everyone


这篇关于部署后按钮单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆