Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how to find a GridView label ClientID in js file

Reply
Thread Tools

how to find a GridView label ClientID in js file

 
 
Deere
Guest
Posts: n/a
 
      10-17-2008
I have an asp:label inside a GridView that I'm trying to put a value
into from a JS file.

I can successfully do it by looking at page source and then manually
constructing the following

document.getElementById("GridView1_ctl02_qty").inn erText = " ( " +
mySplitResult[0] + " )"

But I can't get the server ID of the label by requesting it in the js
file.. I've tried several variations.....
document.getElementById('<%=GridView1.qty.ClientID %>')
document.getElementById('<%=GridView1.FindControl( "qty").ClientID%>');
document.getElementById('<%=qty.ClientID%>')
document.getElementById('<%=GridView1$qty.ClientID %>')

I can though, put a value into a < input type ="text" id="qtyy">
inside Gridview by using.
document.getElementById("qtyy").value = " ( " + mySplitResult[0] +
" )"

can someone point out my error.. or where I need to look



thanks


 
Reply With Quote
 
 
 
 
J. Renou
Guest
Posts: n/a
 
      11-14-2008
I have your solution :

var controlId = '<%= ((TextBox)GridView1.FindControl("qty")).ClientID %>';
document.getElementById(controlId);

enjoy

"Deere" wrote:

> I have an asp:label inside a GridView that I'm trying to put a value
> into from a JS file.
>
> I can successfully do it by looking at page source and then manually
> constructing the following
>
> document.getElementById("GridView1_ctl02_qty").inn erText = " ( " +
> mySplitResult[0] + " )"
>
> But I can't get the server ID of the label by requesting it in the js
> file.. I've tried several variations.....
> document.getElementById('<%=GridView1.qty.ClientID %>')
> document.getElementById('<%=GridView1.FindControl( "qty").ClientID%>');
> document.getElementById('<%=qty.ClientID%>')
> document.getElementById('<%=GridView1$qty.ClientID %>')
>
> I can though, put a value into a < input type ="text" id="qtyy">
> inside Gridview by using.
> document.getElementById("qtyy").value = " ( " + mySplitResult[0] +
> " )"
>
> can someone point out my error.. or where I need to look
>
>
>
> thanks
>
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
can't get clientid of .net label in a JS file Deere Javascript 2 10-28-2008 03:36 PM
Getting the ClientID of a control in a GridView EditTemplate Rickey Whitworth ASP .Net Web Controls 1 11-10-2005 03:14 PM
Trying to find ClientID of web form Neo Geshel ASP .Net 1 06-18-2005 01:57 PM
[ASP. NET VB .NET] clientID and ClientID Maras ASP .Net 1 10-15-2003 02:04 PM



Advertisments