C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




how to display the count of lines from gridview to textbox


Posted Date: 30 Jun 2008      Total Responses: 3

Posted By: G.Hemadribabu       Member Level: Gold     Points: 1



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





Responses

Author: yathika     30 Jun 2008Member Level: GoldRating:     Points: 2

try this
---------
textbox1.text=gridview1.rows.count.tostring()

or else

textbox1.text=ds.tables[0].rows.count.tostring()



Author: Bharathi    30 Jun 2008Member Level: DiamondRating:     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 2008Member Level: DiamondRating:     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



Post Reply
You must Sign In to post a response.
Next : CollapsiblePanelExtender
Previous : To Dharmendra and others...
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use