Click here to Skip to main content
13,000,017 members (45,832 online)
Rate this:
Please Sign up or sign in to vote.
See more:
i am calling a jquery function with ajax it will returned the FName,Lname,Address,Email on basic of specified id. It returns the json type object when i am going to assign these values to TextBox ,Getting error. so please help me.
function BindGridView(id) {
    var params = "{ID:'" + id + "'}";
        type: "POST",
        url: "InsertoninGridViewusingJQuery.aspx/GetRecords",
        data: params,
        contentType: "application/json",
        dataType: "JSON",
        success: function (data) {
            for (var i = 0; i < data.d.length; i++) {
Posted 17-Apr-13 21:33pm
Updated 17-Apr-13 21:39pm
Prasad Khandekar 18-Apr-13 3:44am
Can you post the JSON response and the error? Does your JSON response contains an array named "d". What is UserDetails?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

The problem is data.d contains the data, but you are assigning data like below...
data[i].FName, which will not give you the FirstName.

As you are debugging the code, you can see that the value are in data.d.

So, you should read like data.d[i].FName, but you have to check whether it is working or not. You can use FireBug of Firefox and use the watch window to evaluate this code and check whether you are getting data or not.

And you have used

which are not defined.

You should have used
data.d[i].Address and
data.d[i].Email respectively.
Member 9208074 18-Apr-13 4:52am
thanks i m trying suggest by you.
Tadit Dash 18-Apr-13 4:55am
Ok. And let me know what you found out.
Member 9208074 18-Apr-13 5:12am
i have chaged according to you but still issue remains same. data.d[i].FName having the records i saw the value by debuging it. When assign these values to textbox but values is not displaying in textbox. $("#<%=txtFname.ClientID%>").val(data.d[i].FName);
Tadit Dash 18-Apr-13 7:24am
So, you are getting value in data.d[i].FName, right ?
Have you checked while debugging whether the textbox is accessed or not. I mean the code
$("#<%=txtFname.ClientID%>") selects the textbox or not...

And see if there are any errors in console window of FireBug.

Please check and also post all the html and jQuery code here. I will try to find out the problem at my end.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170624.1 | Last Updated 18 Apr 2013
Copyright © CodeProject, 1999-2017
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