I have a Gridview that uses a RadComboBox with checkboxes enabled to choose an Approval code or multiple denial codes.
I have a asp:checkbox in the grid up in the header as well as next to each RadComboBox control as an 'Approve All' function. It should work similar to the checkboxes in Gmail.
You asp:checkbox in the header, which should check each asp:checkbox next to the RadComboBox controls in each row, will also set each RadComboBox to have the Approve item checked for selection.
When you uncheck a asp:checkbox next to the RadComboBox, you only uncheck that RadComboBox, not all controls in all rows.
I was wanting to do this all client side but can't see the get the checkboxes in the RadComboBox to check or uncheck. Also, I don't know if they are checked clientside if they will be picked up serverside when I'm ready to submit the approvals.
The code is something like what follows:
UPDATED THE CODE - When I had typed this out, I was writing it from memory. I have now posted the code as I am using it. The alerts do come up when I check or uncheck the checkbox next to the RadComboBox.
I have a asp:checkbox in the grid up in the header as well as next to each RadComboBox control as an 'Approve All' function. It should work similar to the checkboxes in Gmail.
You asp:checkbox in the header, which should check each asp:checkbox next to the RadComboBox controls in each row, will also set each RadComboBox to have the Approve item checked for selection.
When you uncheck a asp:checkbox next to the RadComboBox, you only uncheck that RadComboBox, not all controls in all rows.
I was wanting to do this all client side but can't see the get the checkboxes in the RadComboBox to check or uncheck. Also, I don't know if they are checked clientside if they will be picked up serverside when I'm ready to submit the approvals.
The code is something like what follows:
UPDATED THE CODE - When I had typed this out, I was writing it from memory. I have now posted the code as I am using it. The alerts do come up when I check or uncheck the checkbox next to the RadComboBox.
$(checkBoxSelector).live(
'click'
,
function
() {
var
index = $(checkBoxSelector).index(
this
);
var
gridRow = $(
'#MainContent_QueueGrid > tbody > tr:eq('
+ index +
')'
);
if
($(
this
).is(
":checked"
)) {
gridRow.find(
'.rcbCheckBox'
).each(
function
() {
if
($(
this
)[0].nextSibling.wholeText ===
'Approve'
) {
$(
this
)[0].attr(
"checked"
,
true
);
alert(
"Checking the box"
);
}
});
}
else
{
gridRow.find(
'.rcbCheckBox'
).each(
function
() {
if
($(
this
)[0].nextSibling.wholeText ===
'Approve'
) {
$(
this
)[0].attr(
"checked"
,
false
);
alert(
"UNChecking the box"
);
}
});
}
});
I have tried every which way to check or uncheck the Approval code inside the RadComboBox and it is not working.
I can see the Approval checkbox element when I get to the if statement but am not able to set the attribute to checked.
I have tried attr('checked', true) along with every other way I can find.
I know that if the asp:checkboxes are selected I could evaluate the grid with those, but my issue is for user experience. If the Approve All is selected, all of the RadComboBoxes should show Approved as the selcted text as well as if they open the RadComboBox, they should we Approved checked and possibly all denial codes disabled.
Is this something that can be done?
With your help, if I am successful in setting it, will the checked status hold when evaluating the grid in code behind?
Any help is greatly appreciated.
Thanks in advance.
I can see the Approval checkbox element when I get to the if statement but am not able to set the attribute to checked.
I have tried attr('checked', true) along with every other way I can find.
I know that if the asp:checkboxes are selected I could evaluate the grid with those, but my issue is for user experience. If the Approve All is selected, all of the RadComboBoxes should show Approved as the selcted text as well as if they open the RadComboBox, they should we Approved checked and possibly all denial codes disabled.
Is this something that can be done?
With your help, if I am successful in setting it, will the checked status hold when evaluating the grid in code behind?
Any help is greatly appreciated.
Thanks in advance.