Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i have a datagrid with following code

this.dataSet11.Clear();
this.oleDbDataAdapter1.Fill(this.dataSet11,"ClientsTable");
this.dataGrid1.DataSource=this.dataSet11.Tables["ClientsTable"].DefaultView;
DataTable dataTable = (DataTable)dataGrid1.DataSource;

but app return error when try this line:

DataTable dataTable = (DataTable)dataGrid1.DataSource;

why?

i want this code for autoresize DataGrid, so let me know if you have a correct code for autoresizing datagrid. ;)

[ once4ever ]
Posted

there is'nt DataSource properties for table object! but i remove default view and it done.

this.dataSet11.Clear();
this.oleDbDataAdapter1.Fill(this.dataSet11,"ClientsTable");
this.dataGrid1.DataSource=this.dataSet11.Tables["ClientsTable"];
DataTable dataTable = (DataTable)dataGrid1.DataSource;

thank you

[ once4ever ]
  • *Experts*
Posted

If you wanted to bind to the DefaultView, then cast the DataSource back to a DataView instead of DataTable. You would do that if you wanted to bind to a filtered or sorted list of records - things the DataView lets you do.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted

Change sort to specific column

 

how can i change sort to specific column in datagrid, in fact i want sort column that user change focus to it.

maybe you can help me about it here before i create new topic ;)

[ once4ever ]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...