Hi
I have written a Webservice to get records from data babe. Now i want to display those records in Gridview control.
Can any one help me..
Thank you for solution Advance
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Jan 24, 2013, 4:13 AM
Please refer below article which show how write webservice and call them and fill up grid view
http://geekswithblogs.net/PsychoCoder/archive/2007/09/30/intro_to_web_services.aspx
http://www.codeproject.com/Articles/863/Your-first-C-Web-Service
http://www.c-sharpcorner.com/UploadFile/ashok_kp/IntroductionToWebServicesT11252005045531AM/IntroductionToWebServicesT.aspx
hope this will help you.
Rishikesh Kumar SinghPosted Jan 24, 2013, 3:05 AM
you can concatenate your datatable values using pipeline symbol and just return that string. and in your website you invoke the method of web service and receive it in string and you can easily split it and you can bind it to any control.
Ex:-
[WebMethod]
public string get_details(string no)
{
string res = "";
dt = al.GetRecord("select FIRSTNAME from CONTACTS where PHONENO='" + no + "' OR MOBILENO='" + no + "' OR OTHERNO='" + no + "'"); // dt is the object of DataTable
if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
res =res + dt.Rows[i]["FIRSTNAME"].ToString();
if (i < dt.Rows.Count - 1)
{
res = res + "|"; //concatenating by pipeline symbole
}
}
}
return res;
}