Stop a DataGrid from showing related tables

P

Patrick

I have a Windows Forms DataGrid bound to a Table within a DataSet.

The Table is related to others within the DataSet.

The DataGrid allows the user to surf through related tables. I don't want
that behavior; I want the DataGrid to just show the one table. How is this
accomplished?

I tried using this...

DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.RowHeadersVisible = false;

....which gets rid of the [+] symbols on the left side of the DataGrid, but
the user can still surf to related tables using the Tab key on the keyboard.

Thanks!

Patrick
 
D

Dmitriy Lapshin [C# / .NET MVP]

Hello Patrick,

There's a property on the grid called AllowNavigation. Set this one to false
and you are done.
 
P

Patrick

Ah! That worked. Thanks.

Dmitriy Lapshin said:
Hello Patrick,

There's a property on the grid called AllowNavigation. Set this one to false
and you are done.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://www.x-unity.net/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

Patrick said:
I have a Windows Forms DataGrid bound to a Table within a DataSet.

The Table is related to others within the DataSet.

The DataGrid allows the user to surf through related tables. I don't want
that behavior; I want the DataGrid to just show the one table. How is this
accomplished?

I tried using this...

DataGridTableStyle tableStyle = new DataGridTableStyle();
tableStyle.RowHeadersVisible = false;

...which gets rid of the [+] symbols on the left side of the DataGrid, but
the user can still surf to related tables using the Tab key on the keyboard.

Thanks!

Patrick
 
D

DotNetJunkies User

I want to do the same thing except I want the data binding off that is in my code when i do everything you have said minus this line/statement:

this.dg_list.SetDataBinding(this.ds_list, "user_list");

my datagrid shows up blank. I dont want it to be databound.
Now, if i remove this code, I have to set navigation back on to see the values in my one table "user_list".

User_list is a table being populated via a data-adapter via a stored procedure. I just need to do it this way....and there are no updates, deletes, or inserts being done...Any suggestions?
 
D

DotNetJunkies User

I want to do the same thing except I want the data binding off that is in my code when i do everything you have said minus this line/statement:

this.dg_list.SetDataBinding(this.ds_list, "user_list");

my datagrid shows up blank. I dont want it to be databound.
Now, if i remove this code, I have to set navigation back on to see the values in my one table "user_list".

User_list is a table being populated via a data-adapter via a stored procedure. I just need to do it this way....and there are no updates, deletes, or inserts being done...Any suggestions?
 

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