Hello,
I have two textboxes in a row and Having checkbox to select and deselect the row.
If I uncheck the checkbox, I want to disable the two textboxes.
If I check the checkbox, I want to enable the two textboxes.
How can I do this on client side ?
TIA
I have two textboxes in a row and Having checkbox to select and deselect the row.
If I uncheck the checkbox, I want to disable the two textboxes.
If I check the checkbox, I want to enable the two textboxes.
How can I do this on client side ?
TIA
9 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 08 May 2012, 07:00 AM
Hi Tia,
Try the following javascript to disable and enable textbox on selecting or deselecting the row.
JS:
Thanks,
Shinu.
Try the following javascript to disable and enable textbox on selecting or deselecting the row.
JS:
function
OnRowSelected(sender, args)
{
var
masterTable = sender.get_masterTableView();
var
selectedrow = masterTable.get_selectedItems();
for
(
var
i = 0; i < selectedrow.length; i++)
{
var
textbox = selectedrow[i].findElement(
'TextBox1'
);
textbox.disabled =
true
;
}
}
function
OnRowDeselected(sender, args)
{
var
masterTable = sender.get_masterTableView();
var
selectedrow = masterTable.get_selectedItems();
for
(
var
i = 0; i < selectedrow.length; i++)
{
var
textbox = selectedrow[i].findElement(
'TextBox1'
);
textbox.disabled =
false
;
}
}
Thanks,
Shinu.
0
Atchut
Top achievements
Rank 1
answered on 08 May 2012, 02:10 PM
textbox.disabled =
true
;
true and false is not working.
and more over, if the grid is having only one row, it is taking length as 0 and it is not going to loop
0
Jayesh Goyani
Top achievements
Rank 2
answered on 08 May 2012, 02:24 PM
Hello,
Please check below link/demo.
http://www.telerik.com/community/forums/aspnet-ajax/grid/disable-textbox-in-radgrid-using-javascript-jquery.aspx
Let me know if any concern.
Thanks,
Jayesh Goyani
Please check below link/demo.
http://www.telerik.com/community/forums/aspnet-ajax/grid/disable-textbox-in-radgrid-using-javascript-jquery.aspx
Let me know if any concern.
Thanks,
Jayesh Goyani
0
Atchut
Top achievements
Rank 1
answered on 08 May 2012, 02:38 PM
Hello Jayesh,
set_enabled(true) is not working
set_enabled(true) is not working
0
Shinu
Top achievements
Rank 2
answered on 09 May 2012, 05:13 AM
Hello Tia,
Make sure that you have not set EnablePostBackOnRowClick as true. For a single row, access the textbox using the following javascript.
JS:
Hope this helps.
Thanks,
Shinu.
Make sure that you have not set EnablePostBackOnRowClick as true. For a single row, access the textbox using the following javascript.
JS:
var
selectedrow = masterTable.get_selectedItems();
var
textbox = selectedrow[0].findElement(
'TextBox1'
);
Thanks,
Shinu.
0
Atchut
Top achievements
Rank 1
answered on 09 May 2012, 01:37 PM
Hello
I am able to access the textboxes. but after accessing textbox, the above code to disable/enable is not working.
TIA
textbox.disabled =
true
;
I am able to access the textboxes. but after accessing textbox, the above code to disable/enable is not working.
TIA
0
Elliott
Top achievements
Rank 2
answered on 09 May 2012, 06:25 PM
isn't the property Enabled?
try textbox.Enabled=false;
or
textbox.Enabled=True;
try textbox.Enabled=false;
or
textbox.Enabled=True;
0
Atchut
Top achievements
Rank 1
answered on 09 May 2012, 06:36 PM
I tried Enabled also. It is not working.
Is there anyway that I can Disable the whole row when I check on Checkbox
Is there anyway that I can Disable the whole row when I check on Checkbox
0
Elliott
Top achievements
Rank 2
answered on 09 May 2012, 07:28 PM
did you look at this?
http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-disable-specific-row-selection-in-rad-grid-based-on-specific-column-value.aspx
http://www.telerik.com/community/forums/aspnet-ajax/grid/how-to-disable-specific-row-selection-in-rad-grid-based-on-specific-column-value.aspx