Issue 424: Postback problem - client side values not accessible on server side
Status:  Fixed
Owner: ----
Closed:  Apr 2010
Reported by patterson.carey@gmail.com, Feb 1, 2010
I am using nyroModal to develop the login dialog for my VB.NET web application. 

Here's the situation:
--> I have two textboxes on the dialog (username box and password box). Now, when the user enters their 
credentials into these boxes, I check the entries on the server side (against my database) to verify whether 
their login info was correct.

The problem is:
when values are entered into the username and password box, I do not see these values on the server side. i.e. 
txtUsername.Text yields an empty string, (instead of the entered value "smith", for instance).


HERE'S THE CRITICAL CODE:
-->JAVASCRIPT:

function loginClick(){
   if(...){
      return false;
   } else{
      return true;
   }
}

-->HTML

<div id="divBannerLogin" style="display:none;">
   <asp:TextBox ID="txtBLUsername" runat="server"></asp:TextBox>
   <asp:TextBox TextMode="Password" ID="txtBLPassword" runat="server"></asp:TextBox>
   <a runat="server" onclick="return loginClick();" onserverclick="ibtnLogin_Click"><img runat="server"     
id="ibtnLogin" src="../Images/LoginButtonUp.png" alt="Login" /></a>
</div>

-->CODE BEHIND

Protected Sub ibtnLogin_Click(ByVal sender As Object, ByVal e As EventArgs)
   Dim dalEstateJA As New EstatesJADAL
   
   'txtBLUsername.Text and txtBLPassword.Text are both empty strings when the boxes are filled
   
   If dalEstateJA.Authenticate(txtBLUsername.Text, txtBLPassword.Text) Then
       'Action when login is successful
   Else
       'Action when login is unsuccessful
   End If
End Sub
        
Feb 5, 2010
Project Member #1 nyro...@gmail.com
I don't know that much about Asp.Net, but did you try to retrieve your data directly
from the request instead of using the textbox object?
Feb 5, 2010
#2 patterson.carey@gmail.com
Tried doing what you suggested: Request.Form("txtBLUsername").
However, I get the error message: "Object reference not set to an instance of an object, and this is the correct 
name for the textbox. I also tried: Request.Form(txtBLUsername.ClientID) and Request.Form(txtBLUsername.UniqueID);
both of these return the same error message. Maybe I'm not using Request properly, really at a loss. Thanks for the 
help so far.
Mar 18, 2010
#4 carljoha...@gmail.com
If you provide the generated html (your "HTML" is not really HTML) that would really
help. 

Also, I would guess you need to add the "nyroModal"-class to your form (how you do
that with "HTML"/ASP/? I don't know though).
Mar 28, 2010
#5 patterson.carey@gmail.com
Thanks for all your help everyone. I actually used AJAX to solve the problem. Thanks 
Much.
Apr 17, 2010
Project Member #6 nyro...@gmail.com
(No comment was entered for this change.)
Status: Fixed