Accessing Textbox Control in Gridview from Javascript.
-
Dear, I have created html textboxes in GridViewDataRow. I created html textboxes dynamically. I have given the IDs dynamically. By default the textboxes should be disabled. When I click linkbutton outside the gridview with onClientClick event, a javascript function should be called and then all the textboxes in gridview should be enabled. Please help me in implementing this. Help would be appreciated. Regards, Dileep.
-
Dear, I have created html textboxes in GridViewDataRow. I created html textboxes dynamically. I have given the IDs dynamically. By default the textboxes should be disabled. When I click linkbutton outside the gridview with onClientClick event, a javascript function should be called and then all the textboxes in gridview should be enabled. Please help me in implementing this. Help would be appreciated. Regards, Dileep.
Why are you creating textbox dynamically. Its better if you it to be always there, show and hide according to your requirement in rowdatabpound event of gridview.Store the Ids in some hidden field and in JS function, itereate through all the IDs and make them enable.
Cheers!! Brij Check my latest Article :Exploring ASP.NET Validators
-
Dear, I have created html textboxes in GridViewDataRow. I created html textboxes dynamically. I have given the IDs dynamically. By default the textboxes should be disabled. When I click linkbutton outside the gridview with onClientClick event, a javascript function should be called and then all the textboxes in gridview should be enabled. Please help me in implementing this. Help would be appreciated. Regards, Dileep.
Hi, Please try the following: <script language="javascript" type="text/javascript"> function EnableTextBoxes() { var gv = document.getElementById('GridViewID'); var objs = gv.getElementsByTagName('input'); var i=0; for (i = 0; i < objs.length; i++) { if (objs[i].style.display == 'none') { objs[i].style.display = 'block'; } } } </script>
Regards, Jamil
-
Hi, Please try the following: <script language="javascript" type="text/javascript"> function EnableTextBoxes() { var gv = document.getElementById('GridViewID'); var objs = gv.getElementsByTagName('input'); var i=0; for (i = 0; i < objs.length; i++) { if (objs[i].style.display == 'none') { objs[i].style.display = 'block'; } } } </script>
Regards, Jamil
-
Dear, I have created html textboxes in GridViewDataRow. I created html textboxes dynamically. I have given the IDs dynamically. By default the textboxes should be disabled. When I click linkbutton outside the gridview with onClientClick event, a javascript function should be called and then all the textboxes in gridview should be enabled. Please help me in implementing this. Help would be appreciated. Regards, Dileep.
Iterate through the grid view from javascript, find the textbox either by tagname or by Id and enable it like this,
txtBox.disabled=false;
Let me know if it works.Arun Jacob http://codepronet.blogspot.com/