Click here to Skip to main content
       

.NET Framework

 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pinmembersteve_949661320-Nov-12 3:36 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) PinmemberEddy Vluggen20-Nov-12 4:33 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pinmembersteve_949661320-Nov-12 5:23 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) PinmemberEddy Vluggen20-Nov-12 9:21 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) Pinmembersteve_949661320-Nov-12 21:25 
GeneralRe: [VB.NET 2008] Change form from separate thread (Windows CE) PinmemberEddy Vluggen21-Nov-12 5:07 
QuestionBinding gridview from webservice using jquery Pinmembersaravanan2509218-Nov-12 20:41 
AnswerRe: Binding gridview from webservice using jquery PinmemberPhanindra26119-Nov-12 6:05 
The solution to your problem comes in three steps
1. Write [WebMethod] (service) to return data from the datatable. But before returning it to your ajax method call convert it to an array. This is because javascript does not understand things such as datatable,dataset,datarow etc...
 
2. In your aspx page header write an ajax call which should look something like this:-
$(document).ready(function() {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "Default.aspx/BindDatatable",
data: "{}",
dataType: "json",
success: function(data) {
for (var i = 0; i < data.d.length; i++) {
$("#gvDetails").append("<tr><td>" + data.d[i].UserId + "</td><td>" + data.d[i].UserName + "</td><td>" + data.d[i].Location + "</td></tr>");
}
},
error: function(result) {
alert("Error");
}
});
});
inside the script tags. UserName,UserId,Location are column names from the database.
3. Bind a dummy datatable to your gridview. It should look something like this:
private void BindColumnToGridview()
{
DataTable dt = new DataTable();
dt.Columns.Add("UserId");
dt.Columns.Add("UserName");
dt.Columns.Add("Location");
dt.Rows.Add();
gvDetails.DataSource = dt;
gvDetails.DataBind();
gvDetails.Rows[0].Visible = false;
}
 
this is done so that correct data is mapped to the correct columns in gridview.
All the best.
QuestionNlog for .Net compact PinmemberTalSt17-Nov-12 19:24 
AnswerRe: Nlog for .Net compact PinmvpRichard MacCutchan17-Nov-12 21:43 
GeneralRe: Nlog for .Net compact PinmemberTalSt18-Nov-12 1:15 
GeneralRe: Nlog for .Net compact PinmvpRichard MacCutchan18-Nov-12 1:36 
GeneralRe: Nlog for .Net compact PinmemberTalSt18-Nov-12 1:55 
GeneralRe: Nlog for .Net compact PinmvpRichard MacCutchan18-Nov-12 2:06 
AnswerRe: Nlog for .Net compact Pinmemberjschell19-Nov-12 9:11 
News.NET projects in koramangala,bangalore Pinmemberraji.1138716-Nov-12 22:24 
News2013 final year IEEE projects Pinmemberraji.1138716-Nov-12 22:20 
QuestionWebsite Developemnt Pinmemberradha123 from Hyderabad15-Nov-12 1:39 
AnswerRe: Website Developemnt PinmvpRichard MacCutchan15-Nov-12 2:41 
GeneralRe: Website Developemnt PinprotectorPete O'Hanlon15-Nov-12 3:00 
GeneralRe: Website Developemnt PinmvpRichard MacCutchan15-Nov-12 4:12 
GeneralRe: Website Developemnt PinmemberPaul Conrad15-Nov-12 10:37 
AnswerRe: Website Developemnt Pinmemberjschell15-Nov-12 8:07 
GeneralRe: Website Developemnt Pinmemberdojohansen20-Nov-12 6:02 
AnswerRe: Website Developemnt PinmemberZaf Khan19-Nov-12 17:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Mobile
Web04 | 2.8.140821.2 | Last Updated 22 Aug 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid