473,587 Members | 2,413 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to determine the number of rows or columns within a DataGrid

Can someone tell me how you determine the number of rows (or columns) are in
a datagrid? Under the debugger I say the property DataGridRows (which is
what I want) but it doesn't appear to be usable within code. Its protection
level makes it inacccessible.
Dec 20 '05 #1
1 1078

Generally speaking, you know that the datagrid is bound to an IList
implementation. You can cast the DataSource object to IList (or IListSource
perhaps) and then get the number of items from there.

Hope this helps.
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

"Steve Teeples" <St**********@d iscussions.micr osoft.com> wrote in message
news:E1******** *************** ***********@mic rosoft.com...
Can someone tell me how you determine the number of rows (or columns) are
a datagrid? Under the debugger I say the property DataGridRows (which is
what I want) but it doesn't appear to be usable within code. Its
level makes it inacccessible.

Dec 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called "Resource" with the following structure : Resource{,en,fr,es} Yes.. these are the only languages supported actually. A couple of rows in that table would...
by: BBFrost | last post by:
Ok, I know how to count the number of selected datagrid rows using the code below. What has me stumped is how to determine when the selected rows within a datagrid have been changed. The DataGrid object doesn't seem to have a any type of a selection changed type of event I can grab. THE QUESTION: Does anyone know how to determine when...
by: Daniel Walzenbach | last post by:
Hi, I created an ASP.NET Datagrid where a single row can be selected by clicking anywhere on the row (according to http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchTopQuestionsAboutASPNETDataGridServerControl.asp, Selecting Rows by Clicking Anywhere). Private Sub DataGrid1_ItemDataBound(ByVal...
by: Brian Henry | last post by:
Hi, I have a data grid that has the following properties EnableViewState = false AllowPaging = true AllowSorting = true AllowCustomPaging = false now, when the page switches I want to get the current page number and display it in a label on the form... but it doesnt seem to return anything but zero no mater which page i am on in...
by: David | last post by:
Hi, How can I edit all rows of a datagrid at the same time? I have a datagrid that has some bound columns and some template columns with a asp:textbox inside. (Textbox for values that can change..) From the event handler of a link button at the bottom of the page, how can I loop through all the rows of the data grid and read, the...
by: Aaron Smith | last post by:
If I have a datagrid and the bound data file only have 4 rows in it, the grid will show the 4 rows. However, there is blank space below that until it reaches the bottom of the grid. Is there a way to have a fixed number of rows regardless of what data is in the bound table? Thanks, Aaron -- --- Aaron Smith
by: Nick | last post by:
Hi, This is a very common issue. I have a read only Windows Application datagrid, on which i want to prevent the tabbing between the columns and rows. What needs to happen is this: When i hit tab and land on the grid, I have to scroll through the rows using the up/dwon keys . When I hit tab when I'm on the grid, i need to set the focus...
by: Flack | last post by:
Hey guys, I have a DataGrid and DataTable field in my class : private ImageDataGrid dataGrid1; //ImageDataGrid extends dataGrid and just overides OnMouseDown private DataTable dt = new DataTable("MyTable"); In the classes constructor, after InitializeComponent() I call the following
by: Flack | last post by:
I have pasted at the end of this message a small sample program I whipped up to do some testing. It's a form with a datagrid and two buttons. Each button clears the dataTable that is the source of the dataGrid, and then adds five rows. Button2 is the same as button1 just that it does this in a different thread (I was testing if I was...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.