Hi All,
I have a RadGrid with CommandItemDisplay="Top".
In the code behind, I set RadGrid.Enabled = false;
When I run the project, the RadGrid does look disabled, but the link to the right of the [+] button "Add New Record" can still be clicked on.
Is the something special I need to do with this?
Thanks,
Steele.
I have a RadGrid with CommandItemDisplay="Top".
In the code behind, I set RadGrid.Enabled = false;
When I run the project, the RadGrid does look disabled, but the link to the right of the [+] button "Add New Record" can still be clicked on.
Is the something special I need to do with this?
Thanks,
Steele.
6 Answers, 1 is accepted
0
Hello Steele,
I tried to replicate the described issue but to no avail. Please examine the attached project that is working as expected and let me know if it helps.
Regards,
Pavlina
the Telerik team
I tried to replicate the described issue but to no avail. Please examine the attached project that is working as expected and let me know if it helps.
Regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Steele
Top achievements
Rank 1
answered on 20 Jan 2011, 01:06 AM
Hi Pavlina,
It seems I am having issue once again with the OnCommand client event for the grid.
When I add :
to the page and make the Grid call the OnGridCommand function for the OnCommand client event, I get your sample to act like my problem.
Should I just add a check to see if the grid is disabled in my OnGridCommand function and args.set_cancel(true) if it is?
Thanks for the help,
Steele.
It seems I am having issue once again with the OnCommand client event for the grid.
When I add :
<
telerik:RadCodeBlock
ID
=
"RadCodeBlock1"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function OnGridCommand(sender, args) {
var grid = sender;
if (args.get_commandName() == "InitInsert" && grid._editIndexes[0] >= 0) {
alert("Cannot add while editing a record.");
args.set_cancel(true);
}
if (args.get_commandName() == "Delete") {
if (grid._editIndexes[0] >= 0) {
alert("Cannot delete while editing a record.");
args.set_cancel(true);
}
else
var value = confirm("Are you sure you want to delete?");
if (!value)
args.set_cancel(true);
}
}
</
script
>
</
telerik:RadCodeBlock
>
Should I just add a check to see if the grid is disabled in my OnGridCommand function and args.set_cancel(true) if it is?
Thanks for the help,
Steele.
0
Hello Steele,
Note that the described behavior is expected when you have link button in a disabled container. You can examine the following code:
ASPX:
However, to overcome it you can use the solution provided in the attached project.
All the best,
Pavlina
the Telerik team
Note that the described behavior is expected when you have link button in a disabled container. You can examine the following code:
ASPX:
<
asp:Panel
ID
=
"Panel1"
runat
=
"server"
Enabled
=
"false"
>
<
a
href
=
"#"
onclick
=
"alert(1)"
>test</
a
>
</
asp:Panel
>
However, to overcome it you can use the solution provided in the attached project.
All the best,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

Steele
Top achievements
Rank 1
answered on 24 Jan 2011, 01:04 AM
Thanks for the info, but I found the proposed solution a bit cumbersome to implement across all grid controls/pages.
Instead, I utilised the OnCommand event (since that is the code that caused the bug to start with!) and checked if the grid was disabled. If it was, then cancel the event, regardless of what it is.
See my code below for the implementation.
I hope this helps someone else with similar problems.
Steele.
Instead, I utilised the OnCommand event (since that is the code that caused the bug to start with!) and checked if the grid was disabled. If it was, then cancel the event, regardless of what it is.
See my code below for the implementation.
// Used to disable adding and editing and deleting at the same time.
// If the grid rows are updated while in edit mode, the record being
// edited changes!
// Also confirms delete actions
// If grid is disabled, cancel all events
function
OnGridCommandAuditStd(sender, args) {
var
grid = sender;
if
(sender._element.disabled ==
true
) {
// if the grid is disable, cancel the event
args.set_cancel(
true
);
}
else
{
if
(args.get_commandName() ==
"InitInsert"
&& grid._editIndexes[0] >= 0) {
alert(
"Cannot add while editing a record."
);
args.set_cancel(
true
);
}
else
{
if
(args.get_commandName() ==
"Delete"
) {
if
(grid._editIndexes[0] >= 0) {
alert(
"Cannot delete while editing a record."
);
args.set_cancel(
true
);
}
else
var
value = confirm(
"Are you sure you want to delete?"
);
if
(!value)
args.set_cancel(
true
);
}
}
}
}
I hope this helps someone else with similar problems.
Steele.
0

Steele
Top achievements
Rank 1
answered on 24 Jan 2011, 01:15 AM
One further thing.
You can see I am using sender._element.disabled to determine whether the grid is disabled. Is there a better way? Using the _element object seems like a bad idea, but I was unable to find a property/method to retrieve this value.
Any help?
Thanks,
Steele.
You can see I am using sender._element.disabled to determine whether the grid is disabled. Is there a better way? Using the _element object seems like a bad idea, but I was unable to find a property/method to retrieve this value.
Any help?
Thanks,
Steele.
0
Hello Steele,
I think that there is no better option from get_element property to determine whether the grid is disabled.
Regards,
Pavlina
the Telerik team
I think that there is no better option from get_element property to determine whether the grid is disabled.
Regards,
Pavlina
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.