I have my web service to retrieve the data, my issue is I am using a gridview to output the data and I get all of the fields from the table I only want a select few, how can I do this?
Heres my code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
public partial class _Default : System.Web.UI.Page
{
public static DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
localhost.Service1 myws = new localhost.Service1();
ds = myws.GetDataSet();
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
Thanks
You can edit the Datagrid to show only the columns you want shown by using the Datagrid designer and dataitem attributes of each result row….
Click on the Arrow then select edit columns add a bound column for each column you want to display the column name must be the same as the name of the field in the database.
Make sure you set the datagrid to AutoGenerate columns = false.
your emitted html code should look something like this: