Hi Nausheen,

        First of all, the JS part may be better answered on AspNetClient
(but of course any question is OK here :)

        Now down to business.  The DataGrid object is rendered as a
table, with the ID that you gave the DG control.  So for

<asp:DataGrid id="myDataGrid" runat="server" />

You would see this in the browser:

<table id="myDataGrid" blahblahblah...>


        Now in your Javascript (assuming you're in IE; I'm not sure
about Mozilla), you can grab all inputs inside the table like this:

// Write this out using RegisterClientScript or literals 
//  or implicit Response.Writes or whatever
var myTable = document.getElementById("myDataGrid")
var aTextboxes = myTable.getElementsByTagName("INPUT")

        This yiels an array called aTextboxes which contains all input
elements inside the table.  If you have other inputs (radio, etc) then
you'll have to check the type property to make sure it's "text" before
manipulating them.

        Alternatively, you could just iterate through
document.forms[0].elements checking to see if the element is an input
type="text" and the name begins with "myDataGrid".

        Write back if you need more help.

Cheers,

Peter Brunone
___________________
www.EasyListBox.com


-----Original Message-----
From: [email protected]
[mailto:[EMAIL PROTECTED] On Behalf Of Nausheen

I'm creating some dynamic TextBox controls in Datagrid server ctrl in 
ASP.NET and adding them. On the onblur() event
of each TextBox I need to invoke a Javascript function which will
iterate through every TextBox control within the datagrid and add up the
values entered by the user so as to display the sum in a another 
textbox outside the grid control. What Javascript would I use to 
specifically refer to only those TextBox controls owned by the datagrid?





 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to