Multiple datatables in a datagrid

G

Guest

I have a datagrid in windows form bound to a dataset which has list of tables
.. So, when the form is run I see + sign which could be expandable to range of
table names in the grid. How do I find out which table has been selected from
the list on the datagrid?
 
G

Guest

I figured it out and thought let me post the solution.


// add naviagtion event to see which table is being navigated
dataGrid.Navigate += new NavigateEventHandler(Grid_Navigate);

protected void GridGradMap_Navigate(object sender, NavigateEventArgs e)
{
// s will get the table name
string s = ((DataGrid)sender).DataMember.ToString();
MessageBox.Show(s, "Table navigation information");
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top