Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C#3.0
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
Posted 15-Nov-12 12:22pm
Edited 15-Nov-12 14:19pm
v2
Comments
Christian Graus at 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 at 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
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
Best Regards
M.Mitwalli
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
  Permalink  

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

  Print Answers RSS
0 OriginalGriff 363
1 Sergey Alexandrovich Kryukov 286
2 RyanDev 75
3 nv3 60
4 PhilLenoir 60
0 Sergey Alexandrovich Kryukov 6,691
1 OriginalGriff 6,119
2 CPallini 2,473
3 Richard MacCutchan 1,697
4 Abhinav S 1,560


Advertise | Privacy | Mobile
Web02 | 2.8.140821.2 | Last Updated 19 Nov 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100