how to find a GridView label ClientID in js file

D

Deere

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").innerText = " ( " +
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
 
J

J. Renou

I have your solution :

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

enjoy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top