Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Using Javascript, how do you find the number of rows in a datagrid?

Posted on 2007-11-20
5
Medium Priority
?
675 Views
Last Modified: 2008-02-01
I am using vb.net 2.0 and I need to find the the # of rows in a datagrid? Currently I am using:

var ddl = document.getElementById('dgTopicSelection').id;
alert(ddl.lentgh);

but it's giving me the wrong number. Thanks in advance.
0
Comment
Question by:wilcor14
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
john_steed earned 1500 total points
ID: 20322825
Hi,

out of curiosity, why would you want to do that ?
0
 

Author Comment

by:wilcor14
ID: 20322893
I have a drop down in my datagrid and I am running a for loop to find the value of each drop down in each row of the datagrid. I am them collecting the values in a variable and passing it onto the server for processing. Hope this helps.
0
 
LVL 3

Expert Comment

by:john_steed
ID: 20322982
you can use something like this to iterate through the rows in vb.net,

For Each item as DataGridItem in gridMain.Items
' do stuff
dim ddlcomponent as DropDownList = ctype(item.FindControl("ddlComponent"),(DropDownList))

Next
0
 
LVL 3

Expert Comment

by:john_steed
ID: 20322990
in the iteration first check on this
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
0
 

Author Comment

by:wilcor14
ID: 20323245
This is what I was looking for:

document.getElementById('dgTopicSelection').rows.length;

thanks
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question