hi
i am using asp.net , and in tht i am using gridview concept. on selected search, the results will be displayed in the gridview. some times the gridview will be 10 rows, and some times 3 rows, like this
how much rows are there tht no shoudl be displayed in the textbox,
how to do this . pls tel me the code for doingthis
|
| Author: yathika 30 Jun 2008 | Member Level: Gold | Rating: Points: 2 |
try this --------- textbox1.text=gridview1.rows.count.tostring()
or else
textbox1.text=ds.tables[0].rows.count.tostring()
|
| Author: Bharathi 30 Jun 2008 | Member Level: Diamond | Rating: Points: 6 |
You can count the rows of the gridview or DataSour (DataTable consider) of the gridview as:
textbox1.Text = GridView.Rows.Count;
or get the count of records from the database and asign it to a textbox:
Sqlcommand Comm = new SqlCommand(<select count(*) ...>); textbox1.Text = Comm.ExecuteScalar();
or
textbox1.Text = DataTable1.Rows.Count.tostring()
|
| Author: UltimateRengan 30 Jun 2008 | Member Level: Diamond | Rating: Points: 1 |
hi,
when u bind the values to Gridview u count the values. Ex: MyDataGrid.DataSource = ds.Tables("Emptbl").DefaultView MyDataGrid.DataBind() TextBox1.Text = ds.Tables(0).Rows.Count.ToString() i hope this may help u
UltimateRengan nathan.rengan@gmail.com Trichy-Rider Group
|