Click here to Skip to main content
15,896,063 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I am binding a gridview and i want to show total no. of records in a outside text box mean that textbox is not in gridview.
Posted
Comments
VishwaKL 6-Mar-13 4:58am    
better put 1 label or text box and get the count in code behind and bind the value to text box/label


ex: lblRecordValue.Text = Convert.ToString(yourGridview.Count);
J.Karthick 6-Mar-13 5:22am    
best answer
VishwaKL 6-Mar-13 5:26am    
code behind you can track if any changes made to grid view. Java script solution which given Raj may work for you

1 solution

you can try this:-
your GridView:
ASP.NET
<asp:gridview id="gridRow" runat="server">
</asp:gridview>


your button and textbox:
HTML
<input type="button" id="btn" value="Total Row" onclick="rowcount()" />
<input type="text" id="txt" />


your javascript function:
JavaScript
function rowcount() {
   var row = document.getElementById('<%= gridRow.ClientID %>').rows.length;
   document.getElementById('txt').value = row;
 }


Good luck.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900