Getting the number of rows in a datagrid

Hi,

The datagrid on my webform gets filled with some data from my database. I want to find the number of rows that are populated on the datagrid. What is the way to simply find the number of rows that have been filled with data. I want to use that in a for loop.

Thanks,

Snigdha

0
sniggy
9/8/2005 1:42:59 PM
asp.net.web-forms 93655 articles. 6 followers. Follow

3 Replies
793 Views

Similar Articles

[PageSpeed] 5

After you populate your datagrid with data, all you have to do is:
DataGrid.Items.Count
That will give you a count of how many rows are in your grid.



Darmark

Mark as Answer, if this reply answers your post.
0
Darmark
9/8/2005 2:40:03 PM
Get the row count based on your DataSource....For example, if the DaatSource is DataTable dtTable...it would be dtTable.Rows.Count...
0
akchamarthy
9/8/2005 2:43:21 PM
Wow..
that was easy...it is working great !

Thanks,
Snigdha
0
sniggy
9/8/2005 3:31:28 PM
Reply:

Similar Artilces:

How to set the row number and get the row number for ("selected row) in Datagrid
I face a problem that i can't get the selected row of the datagrid in both server side script (VB.net) and client side script (javascript) As i can't use the button column / hyperlink column in the datagrid. Thus , i need to handle the change the background color of the selected row and also to get the selected row number for Update/Delete. Thanks in advance. This depends on how do you perform the selection. Do you want to implement chaning of the SelectedRow at the client side without any postback? If you have no issues with postback, then you can do s little trick here: 1. ...

Get Row Number in Datagrid
Hi I want to delete a databound row in a datagrid using the delete button on the datagrid. I have tried to use Dim RowID As Integer = Convert.ToInt32(shOTQDataGrid1.Items.Item(CInt(e.Item.ItemIndex))) to get the row number. Dim SoqID As Label = CType(shOTQDataGrid1.Items(RowID).FindControl("SOQID"), Label) I need to get the row number(e.g. 0). I search for the specific item "SOQID" and then use a custom Class to delete the record from the Database with the value of SoqID.Text. Dim sh As New ShiftOvertimeQualifiersClass Dim SoqID As Label = CType(shO...

Get DataGrid rows from Request.Form()
DataGrid has modifyable form fields in it - text boxes. The user may type in the text boxes that are in the DataGrid. I would like to loop through the rows in this DataGrid when the user presses an Update Button above the DataGrid. Do I need to access the DataGrid rows from the Request.Form()?  How would I do this? THX, No, you don't need to. Assuming you have TextBox with ID TextBox1 in DataGrid's (ID DataGrid1) ItemTemplate you can access the TextBoxes in dg row by row as followsDim dgi As DataGridItemFor Each dgi in DataGrid1.Items   Dim ...

windows form datagrid number of rows
Hi, is there a way to retrieve the number of rows within a datagrid on a windows form (not a webform ) ? kind regards frans van ek Your in the ASP.NET forums.Mike Schellenberger - MCAD Although it is a wrong list, the only way to find out the amount of rows in the Windows.Forms.DataGrid i know is to use it's underlying data source.Bug [MCSD] Why is it a wrong list. Windows form are still in asp.net ? I personally don't mind questions not directly related to asp.net being posted here provided there are people who can provide answers to them. Windows forms are not part o...

Implementing .Net Form into an APS.net web form, can this be done
I am new here, but have been searching for a while, and may not have the correct lingo to find what I am looking for.  I am tasked with implementing a .exe application that was writen vb6 then converted to .net into a new website my team is developing. The idea is to put each of the 3 different forms in this .exe application of 3 different .aspx pages. I have attempted multiple things to get this into the page and even started to just rewrite it as an ASP.net web form, but even then I can't reuse any of the code since the System.Web.UI.Page doesn't inherit the sa...

Getting row number when item is clicked on datagrid
I've got a datagrid on an asp.net page with a bound column and two template columns. The template columns contain image buttons that will allow users to edit and delete records corresponding to the value located in the bound column. The problem that I am having is finding out the row number that corresponds to the image button that is pressed. At the moment the image buttons has an OnClick event that runs some code but not sure how to pull in the datagrid row. Do I need to use the datagrid's itemcommand event somehow with the template column.  Cheers On cl...

Multiple Selection of rows in a Web forms datagrid
Hello, I have a Web forms datagrid which displays more than 1000 rows, each row identified by an ID. Is it possible to multi select some of the rows? I would like to drag the mouse and select some of the rows and leave some and once again start selecting some of them and when I click the button below that grid, I should be able to remember those ID's for my next step. I know that I can do it using the check box option. I can also do that using a mouse click event. But I am wondering whether there is an option to drag the mouse and select the rows? Can I write some javascript ...

getting start with vb.net and crystal repots(web form)
I use Crystal Report9 in Visual Studio.NET 2003..... Example at Northwind database I want a application that.....a form include a combobox that contain CustomerID.....If I choose one CustomerID and click OK button....a Report will display information about this Customer......I think that must use Paramater.....how to do that ???? (How do I start to coding --please step by step or sample) please help me !!! Thank you so much!!! very good I have Dropdownlist when I choose the 'month'--> the all data of this field will show I use this Private Sub ddlMonth_Sel...

How to get datagrid rows information from one web page to another
Hi Friends,   this is Rambhopal  i am in asp.net technologies i am getting problem to get Gridview information to another page how to do that     Pls help send me mail for this address; rambhopalreddy@yahoo.co.in Thanks rambhopalreddyRegards Rambhopal Reddy EPlease remember to click “Mark as Answer” on the post that helps you, and to click “Unmark asAnswer” if a marked post does not actually answer your question. I didnt get your question? What you mean by GridView information to another page? Do you want the same grid to be displayed in another page also? If ...

Get the Row Number or Row ID
Hi, I am using Sybase Central v4.3 with Interactive SQL to query the SQL Commands. My concern is how to get the rownumber or row id in select queries. Is there any in built commands in the ASE. If not please suggest me how to get the rownumber. Thanks.... Unless i'm mistaken, ASE does not use a rowid... it can have a timestamp, but it is updated with every modification to the row. http://infocenter.sybase.com/help/topic/com.sybase.help.ase_15.0.blocks/html/blocks/blocks34.htm -- Cory Sane [TeamSybase] Certified Sybase Associate DBA for ASE 15.0 "Santhanam P" wrote...

vs.net web forms wysiwyg resize row problem
I don't know if someone ever when throw this problem, but something weird is happening with the wysiwyg from web forms of .net, the problem is the following: sometimes when i'm selecting a control in the HTML mode it selects to resize the row by mistake, the resize mouse pointer appears and i click to drop the resize mode, but then i'm not allowed to go outside of the table that i resized the row even dropping the resize mode, i try to change to code mode, and it allows to go beond the table but when i get cack to HTML mode it doesm't i'm forced to restart the vs.net, this is quite anoyng...

Different Data Format based on different rows on the same web form and same datagrid
I have a web form and datagrid and just two rows of data and two columns(description and amount) . Can I format one row (revenue) without decimal points and another row(price) with decimal points in vb.net?? Thanks a lot! Description Amount Revenue 10,000,000 Price 9.99 Hi Take a look @ : Helper Functions HTHK B ShajudeenAreYaar.comDubai, United Arab Emirates....

IN VS.Net how can i get a web form to scroll (design mode)
In design mode in VS.Net, there is a scroll bar next to the web form, but it is grayed out.  I can not figure out how to enable it.  I want to design a web form that is larger in size than the surface area shown in teh deisgn window.  Can someone help out with this?Thank you. VS design surface shows how the page is going to be rendered in the browser. Therefore, there is no 'virtual' large size. In the browser scroll bar appears if the browser window is smaller than the page content. You can make scroll bar to appear by enclosing page content in a large container e...

Web Forms: Get the cells' values from DataGrid with AutoGenerateColumns = true
Dear frinds I've a DataGrid configured with AutoGenerateColumns = True. I've a ItemDataBound event, I want to get the cells' values but all the cells returns a Null String "". The DataGrid contains 14 columns and the fields and all the data are bind correctly, but I want to put the cells' values in variables. For example'I declare these 2 global variables:'Dim sColuna1, sColuna2 As StringPrivate Sub dgAutoGenerate_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dgAutoGenerate.ItemDataBound     &nbs...

Web resources about - Getting the number of rows in a datagrid - asp.net.web-forms


Want to preview our new DataGrid for Xamarin.Forms?
tl;dr Zumero.DataGrid is a Xamarin.Forms control for displaying data in rows and columns. If you would be interested in testing and previewing ...

Mad King DataGrid
This post is about scrolling in WPF and the egocentric DataGrid control. I’ll give the project background but if all you’re interested in is ...

Stack Overflow
Stack Exchange log in - careers - chat - meta - about - faq Questions Tags Users Badges Unanswered Ask Question Top Questions interesting 295 ...

Microsoft Silverlight - Wikipedia, the free encyclopedia
Microsoft Silverlight is an application framework for writing and running rich Internet applications , with features and purposes similar to ...

Flash Builder Plug-in for SAP Netweaver Gateway - Adobe Labs
Search Navigation Labs Home Wiki Home Technologies Alchemy Blueprint Camera Profiles and DNG Profile Editor Cirrus ColdFusion 10 DNG Codec Fireworks ...

Casaba Security » Products » X5s Testing Tool For Finding XSS Vulnerabilities
Security analysis, consulting, development and testing partners who understand your business strategy.

CodeGuru - Microsoft developers related ideas, articles, tips, tricks, comments, downloads, and so much ...
CodeGuru is where developers can come to share ideas, articles, questions, answers, tips, tricks, comments, downloads, and so much more related ...

Caliburn Micro: WPF, Silverlight, WP7 and WinRT/Metro made easy.
A small, yet powerful framework designed for WPF, Silverlight and WP7. It implements a variety of UI patterns for solving real-world problems. ...

Quick Answers - CodeProject
Questions - Free source code and tutorials for Software developers and Architects.; Updated: 11 Jul 2012

license-discuss@opensource.org: 11636: first draft of license proliferation committee report
FYI,the first draft report of the OSI's License Proliferation Committee.To join the OSI's license proliferation discuss email list, send anemail ...

Resources last updated: 12/28/2015 1:04:41 PM