I am a newbie of JQuery and got stuck with sending data from JQuery Modal to
asp.net page.
Here is my code:
<code>
function getGrower(rowid)
{
// get data in the selected row and prepare query string
var c = 0;
var str = "";
$("#result_tbl tr td." + rowid).each(function()
{
var cell_val = $(this).text();
cell_val = replace_and(cell_val);
if (c == 0) str = "GrowerID=" + cell_val;
if (c == 1) str += "&LicenseNumber=" + cell_val;
if (c == 2) str += "&FarmName=" + cell_val;
if (c == 3) str += "&FirstName=" + cell_val;
if (c == 4) str += "&LastName=" + cell_val;
if (c == 5) str += "&AddressLine1=" + cell_val;
if (c == 6) str += "&City=" + cell_val;
if (c == 7) str += "&State=" + cell_val;
if (c == 8) str += "&Zip=" + cell_val;
if (c == 9) str += "&Phone=" + cell_val;
if (c == 10) str += "&Email=" + cell_val;
if (c == 11) str += "&County=" + cell_val;
c++;
});
// alert(str);
// send data to server for processing and notify the user
$.ajax({
type: "POST",
url: "ClaimManagementType.aspx",
data: str,
success: function(){
alert( "The form has been populated with selected grower
successfully.");
}
});
}
function replace_and(str)
{
return str.replace('&', '[and]');
}
</code>
Here is the VB.NET to grab data from the AJAX
<code>
Private Sub GetGrowerFromSearch()
If Not String.IsNullOrEmpty(Request.Params("FirstName")) Then
Me.tbClaimantFirstName.Text =
Restore_and(Request.Params("FirstName"))
End If
If Not String.IsNullOrEmpty(Request.Params("LastName")) Then
Me.tbClaimantLastName.Text =
Restore_and(Request.Params("LastName"))
End If
If Not String.IsNullOrEmpty(Request.Params("AddressLine1")) Then
Me.tbClaimantAddress.Text =
Restore_and(Request.Params("AddressLine1"))
End If
If Not String.IsNullOrEmpty(Request.Params("City")) Then
Me.tbClaimantCity.Text = Restore_and(Request.Params("City"))
End If
If Not String.IsNullOrEmpty(Request.Params("Zip")) Then
Me.tbClaimantZip.Text = Restore_and(Request.Params("Zip"))
End If
Dim state As String
If Not String.IsNullOrEmpty(Request.Params("State")) Then
state = Restore_and(Request.Params("State"))
GetGrowerStates(Me.ddClaimantState, state)
End If
If Not String.IsNullOrEmpty(Request.Params("Phone")) Then
Me.txtPhone.Text = Restore_and(Request.Params("Phone"))
End If
If Not String.IsNullOrEmpty(Request.Params("FarmName")) Then
Me.tbClaimantBusinessName.Text =
Restore_and(Request.Params("FarmName"))
End If
End Sub
Private Function Restore_and(ByVal str As String) As String
Return str.Replace("[and]", "&")
End Function
</code>
The sent data get all the way to the targeted ASP.NET page.
My problem is that the form controls in the targeted page do not get
populated.
The data does not show up in the form on the targeted page.
Please help explain and possibly identify the problem.
Any helps will be appreciated.
--
View this message in context:
http://old.nabble.com/JQuery-Modal-AJAX-and-ASP.NET-tp26944257s27240p26944257.html
Sent from the jQuery UI Discussion mailing list archive at Nabble.com.
--
You received this message because you are subscribed to the Google Groups
"jQuery UI" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/jquery-ui?hl=en.