binding dataset passed from web service to a web form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am returning a dataset object from a web service method to a subscribing web form application. I create a dataset object and set the value equal to the passed dataset. When I databind to a datagrid, nothing happens. I have had luck doing this directly but not by passing the object from a web service. Are there any examples of this? Is there anything special that I need to do?
 
Mike:

There shouldn't be any difference once the dataset is returned. Are you
calling DataGrid.DataBind after setting the datasource and have you
confirmed that you have rows? Can you post the code where you bind the
grid?
Mike said:
I am returning a dataset object from a web service method to a subscribing
web form application. I create a dataset object and set the value equal to
the passed dataset. When I databind to a datagrid, nothing happens. I have
had luck doing this directly but not by passing the object from a web
service. Are there any examples of this? Is there anything special that I
need to do?
 
Here is the binding code
private void Button2_Click(object sender, System.EventArgs e

localhost.PubsWebService ms = new localhost.PubsWebService()
DataSet getTitles = ms.GetTitles(TextBox1.Text)
DataGrid DataGrid1 = new DataGrid()
DataGrid1.DataSource = getTitles.Tables
DataGrid1.DataBind()

I know that it is returning a single result with my input because I can display it with
private void Button2_Click(object sender, System.EventArgs e

localhost.PubsWebService ms = new localhost.PubsWebService()
DataSet getTitles = ms.GetTitles(TextBox1.Text)
ListBox1.Items.Add(getTitles.Tables["Table"].Rows[0]["title"].ToString())

Is there something that I am missing in the databind

----- William Ryan eMVP wrote: ----

Mike

There shouldn't be any difference once the dataset is returned. Are yo
calling DataGrid.DataBind after setting the datasource and have yo
confirmed that you have rows? Can you post the code where you bind th
grid
Mike said:
I am returning a dataset object from a web service method to a subscribin
web form application. I create a dataset object and set the value equal t
the passed dataset. When I databind to a datagrid, nothing happens. I hav
had luck doing this directly but not by passing the object from a we
service. Are there any examples of this? Is there anything special that
need to do
 
Mike:

I'm not sure how many tables are in the DataSet, but try setting the
DataSource to either getTitles or getTitles.Tables[0]; and see if that makes
any difference. From the rest of your code, all looks ok assuming you have
rows, which is confirmed with the button2 click. The only difference is
that button 2 is displaying the results from Tables["Table"] so that's why I
think maybe manipulate the datasource.

Let me know if that isn't it b/c the rest looks ok.

Bill
Mike said:
Here is the binding code:
private void Button2_Click(object sender, System.EventArgs e)
{
localhost.PubsWebService ms = new localhost.PubsWebService();
DataSet getTitles = ms.GetTitles(TextBox1.Text);
DataGrid DataGrid1 = new DataGrid();
DataGrid1.DataSource = getTitles.Tables;
DataGrid1.DataBind();
}
I know that it is returning a single result with my input because I can display it with:
private void Button2_Click(object sender, System.EventArgs e)
{
localhost.PubsWebService ms = new localhost.PubsWebService();
DataSet getTitles = ms.GetTitles(TextBox1.Text);
ListBox1.Items.Add(getTitles.Tables["Table"].Rows[0]["title"].ToString());
}
Is there something that I am missing in the databind?

----- William Ryan eMVP wrote: -----

Mike:

There shouldn't be any difference once the dataset is returned. Are you
calling DataGrid.DataBind after setting the datasource and have you
confirmed that you have rows? Can you post the code where you bind the
grid?
Mike said:
I am returning a dataset object from a web service method to a
subscribing
web form application. I create a dataset object and set the value equal to
the passed dataset. When I databind to a datagrid, nothing happens. I have
had luck doing this directly but not by passing the object from a web
service. Are there any examples of this? Is there anything special that I
need to do?
 
Back
Top