Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to get the textbox id of gridview in javascript to check the condition.
Posted

Check the id of the textbox in the generated html & follow it.It may be different.

Modify your code according to the code below:

JavaScript
document.getElementById('ContentPlaceHolder1_GridView1_txtHours_' + i.toString()).value
 
Share this answer
 
Comments
nandakishoreroyal 12-Jul-13 5:45am    
Hello Priyanka,

I no need the value.

I just want to have the object to focus cursor on to it...

Please help me..
vinay.tatipamula 15-Jul-13 5:42am    
Give a dummy class for the textbox you want to set the focus, if u have jquery reference in the page,u can use the following code.

$('#<%=GridID.ClientID> .textboxClass').focus();
Priyanka7777 12-Jul-13 5:51am    
Object????
Naz_Firdouse 15-Jul-13 2:54am    
to set focus,you can do like this
document.getElementById("xxxx").focus();
C#
function focusTextbox(txt1,txt2)
{
if( document.getElementById(txt1).value.length >=document.getElementById(txt1).maxLength )
    {
        document.getElementById(txt2).focus();
    }
}
 
Share this answer
 
Have you used jquery plug-in in your project. If so, i will help how to find the textbox and focus on it.
 
Share this answer
 
Comments
nandakishoreroyal 15-Jul-13 6:27am    
No I didt use any Jquery plugins.

Through javascript only i need to access the object

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