4 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 19 Nov 2013, 11:05 AM
Hi Priyank,
Please try the following code snippet to disable a LinkButton inside CommandItemTemplate.
ASPX:
C#:
Thanks,
Princy
Please try the following code snippet to disable a LinkButton inside CommandItemTemplate.
ASPX:
<
CommandItemTemplate
>
<
asp:LinkButton
ID
=
"LinkButton1"
runat
=
"server"
>LinkButton</
asp:LinkButton
>
</
CommandItemTemplate
>
C#:
protected
void
RadGrid1_PreRender(
object
sender, EventArgs e)
{
RadGrid1.AllowPaging =
false
;
RadGrid1.Rebind();
int
count = RadGrid1.MasterTableView.Items.Count;
//Get the count of rows
RadGrid1.AllowPaging =
true
;
RadGrid1.Rebind();
foreach
(GridCommandItem cmditm
in
RadGrid1.MasterTableView.GetItems(GridItemType.CommandItem))
{
if
(count == 0)
{
LinkButton lnkbtn = (LinkButton)cmditm.FindControl(
"LinkButton1"
);
lnkbtn.Enabled =
false
;
}
}
}
Thanks,
Princy
0
Priyank
Top achievements
Rank 1
answered on 19 Nov 2013, 12:43 PM
Hi Princy,
As per your suggested solution, the linkbutton is enabled and disabled as per the grid items count but now the collapse/expand button of grid item is not working and the linkbutton's click event is not getting executed.
Thanks,
Priyank
As per your suggested solution, the linkbutton is enabled and disabled as per the grid items count but now the collapse/expand button of grid item is not working and the linkbutton's click event is not getting executed.
Thanks,
Priyank
0
Princy
Top achievements
Rank 2
answered on 20 Nov 2013, 08:51 AM
Hi Priyank,
Please try setting the HierarchyLoadMode="Client" property in the MasterTableView of the Radgrid, also set the ClientSettings AllowExpandCollapse="true".
ASPX:
Thanks,
Princy
Please try setting the HierarchyLoadMode="Client" property in the MasterTableView of the Radgrid, also set the ClientSettings AllowExpandCollapse="true".
ASPX:
<
MasterTableView
HierarchyLoadMode
=
"Client"
. . .>
. . . . . .
<
ClientSettings
AllowExpandCollapse
=
"true"
/>
Thanks,
Princy
0
Priyank
Top achievements
Rank 1
answered on 20 Nov 2013, 12:32 PM
Thanks a lot Princy.
It worked!!
Thanks,
Priyank
It worked!!
Thanks,
Priyank