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.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rishikesh Kumar SinghRank #1,250 · 1.4K reputationPosted Jan 23, 2013, 10:05 PM EST
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;
}
Jignesh TrivediRank #16 · 50.3K reputationPosted Jan 23, 2013, 11:13 PM EST
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.