| Protected Sub panelmenu1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadPanelBarEventArgs) Handles panelmenu1.ItemDataBound |
| Dim dataRow As DataRowView = DirectCast(e.Item.DataItem, DataRowView) |
| If functions.FucGetPageID = dataRow("ID").ToString() Then |
| e.Item.Selected = True |
| e.Item.Expanded = True |
| End If |
| End Sub |
| <telerik:RadPanelBar runat="server" EnableViewState="false" CausesValidation="False" EnableEmbeddedSkins="False" ID="panelmenu1" Width="100%" OnPreRender="panelmenu1_PreRender" OnItemClick="RadPanelBar1_ItemClick" /> |
Hi,
In my web application, I am trying to integrate RadGrid from code behind and depending on the GridBoundColumn DataField “Status” (having value 1 and 0), I would like to show/hide “Deactivate”/”Activate” image command button written under ItemTemplate, After lot of Googling, I couldn’t find similar solution. If there is any way out to achieve this, please suggest.
My code is as followes,
<telerik:RadGrid ID="RadGrid1" runat="server" AllowMultiRowSelection="True" AllowPaging="True" AllowSorting="True" AllowAutomaticDeletes="True" OnItemCommand="RadGrid1_ItemCommand">
<MasterTableView EditMode="PopUp" PageSize="20" AutoGenerateColumns="False" DataKeyNames="Consequence_Id" ClientDataKeyNames="Consequence_Id">
<PagerStyle Mode="NextPrevAndNumeric" />
<Columns>
<telerik:GridBoundColumn DataField="Module_Content_Text"
HeaderText="Consequence_Name" SortExpression="Module_Content_Text"
UniqueName="Module_Content_Text">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Status" Visible="false"
UniqueName="Status">
</telerik:GridBoundColumn>
<telerik:GridTemplateColumn UniqueName="CheckBoxTemplateColumn">
<HeaderTemplate>
<table width="100%">
<tr>
<td>
Options</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table width="100%">
<tr>
<td>
<asp:ImageButton ID="ImgBtnDeactivate" ToolTip="Deactivate Record" runat="server" CausesValidation="False" CommandName="Deselect" OnClientClick="return confirm('Are you sure you want to Deactivate this record?');" ImageUrl="~/Images/icon/cross.gif" />
</td>
<td>
<asp:ImageButton ID="ImgBtnActivate" ToolTip="Activate Record" runat="server" CausesValidation="False" CommandName="Select" OnClientClick="return confirm('Are you sure you want to Activate this record?');" ImageUrl="~/Images/icon/right.gif" />
</td>
<td>
<asp:ImageButton ID="ImgBtnDelete" ToolTip="Delete Record" runat="server" CausesValidation="False" CommandName="Delete" OnClientClick="return confirm('Are you sure you want to delete this record?');" ImageUrl="~/Images/icon/delete.gif" />
</td>
<td>
<asp:ImageButton ID="ImgBtnEdit" ToolTip="Edit Record" runat="server" CausesValidation="False" CommandName="Edit" OnClientClick="return confirm('Are you sure you want to Edit this record?');" ImageUrl="~/Images/icon/edit.gif" />
</td>
</tr>
</table>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
------------------------------------------------
private void displayConsequenceGrid()
{
MiddleWare.BL.Consequence objC = new MiddleWare.BL.Consequence();
DataTable dt = new DataTable();
objC._Company_Id = System.Convert.ToInt32(Session[CSession.__Session_Company_Id]);
objC._Language_Id = System.Convert.ToInt32(Session[CSession.__Session_Lanuage_Id]);
dt = objC.GetDataAllConsequence();
RadGrid1.DataSource = dt;
RadGrid1.DataBind();
}
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
int retResult = -100;
MiddleWare.BL.Consequence oConsq = new MiddleWare.BL.Consequence();
oConsq._Updated_By = Convert.ToInt32(Session[CSession.__Session_User_Id]);
oConsq._Module_Id = oConsq._Module_Id;
if (e.CommandName == RadGrid.EditCommandName)
{
int Consequence_Id = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Consequence_Id"].ToString());
}
else if (e.CommandName == RadGrid.DeleteCommandName)
{
oConsq._Consequence_Id = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Consequence_Id"].ToString());
retResult = oConsq.DeleteConsequence();
if (retResult == 2)
{
displayConsequenceGrid();
}
}
else if (e.CommandName == RadGrid.SelectCommandName)
{
oConsq._Consequence_Id = Convert.ToInt32(e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["Consequence_Id"].ToString());
retResult = oConsq.ActivateConsequence();
if (retResult == 1)
{
displayConsequenceGrid();
}
}
I am attaching the required result page as attached picture. Please help me out.
.reToolbar.Vista
.tbiEntity {
background-image: url(/images/rgb.png);
}

| switch (rbl.SelectedValue) |
| { |
| case "Full": |
| radTreeView.CheckAllNodes(); |
| return; |
| case "None": |
| isChecked = false; |
| break; |
| case "Partial": |
| isChecked = false; |
| break; |
| default: |
| break; |
| } |
| foreach (RadTreeNode node in radTreeView.Nodes) |
| { |
| node.Checked = isChecked; |
| } |