Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 6th, 2007, 03:08 PM
Registered User
 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Need to get value of gridview template columns for

Hi,

I'm pulling data into a gridview and allowing the user to update the data in template columns (textboxes). I want to validate the data entered on the client side by iterating through all the cells before I update the DB. I have no problem accessing the value of non-template Gridview cells using the following code

document.getElementById("<%=grdEmployeeBudget.Clie ntID %>").rows[1].cells[0].innerText;

but it returns an empty string on the template columns. Any ideas on how to access those cell values? thanks in advance for the help!!



 
Old January 6th, 2007, 11:10 PM
Registered User
 
Join Date: Jan 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi,

I got the answer from another forum, so I thought I'd post the answer. This code grabs the value from anything that's an "input" control and dumpit into an array - validations easy from there.

function validateGridData()
{
var inputs = [];
var i;
inputs = document.getElementById("<%=grdEmployeeBudget.Clie ntID %>").getElementsByTagName("input");

for (i in inputs)
{
if (i != "length")
{
if (isNaN(inputs[i].value) == true || inputs[i].value.length < 1)
return false;
}
}
return true;
}






Similar Threads
Thread Thread Starter Forum Replies Last Post
Filtering Template columns in Detailsview shashipandey ASP.NET 2.0 Professional 0 September 20th, 2007 04:58 AM
getting values from template columns itemtemplate Laxmikant_it ASP.NET 1.0 and 1.1 Professional 4 February 6th, 2007 04:19 PM
Template Columns in a Datagrid Greg Griffiths ASP.NET 1.0 and 1.1 Basics 1 October 28th, 2004 08:02 AM
Template Columns in DataGrids jbenson001 ASP.NET 1.x and 2.0 Application Design 19 September 19th, 2004 08:48 AM
Template Columns in DataGrids jbenson001 ASP.NET 1.x and 2.0 Application Design 3 March 12th, 2004 11:01 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.