Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
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:
C#
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();
       }

   }

XML
<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
Posted
Updated 15-Nov-12 14:19pm
v2
Comments
Christian Graus 15-Nov-12 18:39pm    
Why on earth does your proc return the password instead of comparing it in the DB ? An update panel means AJAX, have you looked at it in fiddler to see what is happening ? Are your other events also via AJAX ? Is ASP.NET AJAX installed on the server ? Have you looked at it in chrome for JS errors ?
Member 9291223 15-Nov-12 19:02pm    
Yes all the requirement are installed. Event the cancel button event on that same modalpopup is working fine.Its just the Ok button isn't working

Hi ,
Check this asyncpostbacktrigger

XML
<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[^]
Best Regards
M.Mitwalli
 
Share this answer
 
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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900