ASP.NET - gridview row count

Asked By Prabhakaran
04-Feb-12 01:24 AM
hi friends,

 how to find the asp:gridview row count through javascript?


thanks in advance..
  dipa ahuja replied to Prabhakaran
04-Feb-12 03:20 AM
var rowscount = document.getElementByID(<%=Gridview1.ClientID%>).rows.length;
 
alert(rowscount);
  Suchit shah replied to Prabhakaran
04-Feb-12 06:35 AM
See below javascript code for count

<script type="text/javascript">
    function SelectAll(id)
    {
      //get reference of GridView control
      var grid = document.getElementById("<%= GridView1.ClientID %>");
      if (grid.rows.length > 0)
      {
         alert("The Number of Row is" + grid.rows.length);
      }
    }
  </script>    
Create New Account
help
Web Application How can work with gridview inside a gridview by using single database table? Explain with an example? Hi use this code <%@ Page Language runat = "server" > < title > Untitled Page < / title > < / head > < body > < form id = "form1" runat = "server" > < div > < asp:GridView ID = "GridView1" runat = "server" AutoGenerateColumns = "False" > < Columns > < asp:BoundField DataField = "CompanyName" HeaderText = "CompanyName" / > < asp:TemplateField > < ItemTemplate > < asp:GridView ID = "GridView2" DataSource = '<%#((DataRowView)Container.DataItem).CreateChildView("ParentChild") %> ' runat = "server" AutoGenerateColumns = "False" > < Columns > < asp:BoundField DataField = "Dept" HeaderText = "Department" / > < asp:BoundField DataField = "name" HeaderText = "Name" / > < / Columns > < / asp:GridView > < / ItemTemplate > < / asp:TemplateField > < / Columns > < / asp:GridView > < / div > < / form > < / body > < / html > using System; using System.Data; using System.Configuration; using System.Collections summary> private int _columnCount = -1; #region Property: RowExpanded private RowStates _rowExpanded; / / / <summary> / / / Specifies whether a Row is expanded or collapsed / / / Please note that this property is only available after the Items rows of a relation or to / / / load one instance of the template for each child row or to defer the decision until run time. / / / You can use TemplateDataModes.Table if you
how to display different images in gridview i want to display images in gridview using item template See the following articles http: / / www.codeproject.com / KB / aspnet / GridImage.aspx aspx http: / / www.devasp.net / net / articles / display / 692.html Hope this helps. Populating the GridView Control: The next step is to populate the GridView control with data as well as images. Take a look at the code below which is used to populate the GridView. private void BindData() { SqlConnection myConnection = new SqlConnection (ConnectionString); SqlDataAdapter ad = new SqlDataAdapter ( "SELECT UserID, FirstName thousand of times. Now, let's see how we can display the images into the GridView control. Display Images into the GridView Control: The first thing you need to do is to add a template column in the GridView control. Once, you have added the template column simply add an Image server control inside
Re:Export from Gridview to Excel Hi All, Thanks for ur response my question is not only about exporting me to overcome this issue. . In this example, we will see how to Export an ASP.Net GridView to Microsoft Excel. In this example we declare one SqlDataSource control, one ImageButton control and one GridView control in an .aspx file. On click ImageButton control be export GridView data to Microsoft Excel. 1. web.config asp.net data control C# asp.net data control C# asp.net data control C# asp.net
ASP.NET DataList and DataRepeater Controls This is the third article in a three part series of articles pertaining to the understanding and application of ASP.NET 2.0 data controls. This article will address common functionality that may be required from ASP.NET DataList and DataRepeater data controls ASP.NET 2.0 Data Controls Author: Douglas Minnaar The intent of this series is to provide
How to use gridview control in asp.net? Hi Friends, I want to know how to use the grid view control in asp.net. give me some example. Thanks & Regards, Stephen. L hi • The GridView control is associated with the DataSource control through its DataSourceID property. • In ASP.NET 2.0 there are several DataSource controls that are designed to work with different data