2 Questions about DataGrid

G

Guest

hello,

i have a datagrid (in C#) and i have 3 questions:

1. how can i know how many rows my dataGrid(dataSet\DataAdapter) has? is it possiable to know with asking the database or i must do it in my storedprocedure and sent it back to the application?

2. how can i make my dataGrid to display the last rows and not the first?

3. my last row is an empty row, how can i prevent that row from being created?

thanks
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi ,
i have a datagrid (in C#) and i have 3 questions:

1. how can i know how many rows my dataGrid(dataSet\DataAdapter) has? is
it possiable to know with asking the database or i must do it in my
storedprocedure and sent it back to the application?

You can use DataTable.Rows.Count to know the number of rows in it. In
general you use the datasource to know it.
2. how can i make my dataGrid to display the last rows and not the first?

You have to filter the datasource for this and eliminate the rows as needed.
3. my last row is an empty row, how can i prevent that row from being
created?

IIRC this is done by using a DataView as the datasource and setting it as
read only.

Cheers,
 

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