Three different Grid functions

1 posts, 0 answers
  1. Suzan
    Suzan avatar
    17 posts
    Member since:
    Feb 2011

    Posted 13 Mar 2018 Link to this post

    I have a grid with 3 different button columns

    This is the code

    <telerik:RadGrid runat="server" ID="RadGridClassOverview" ShowFooter="false" Width="100%" Enableajax="true" ShowStatusBar="True"
    allowaddingrecords="false" AutoGenerateColumns="false" AllowSorting="false" allowpagesizeselection="False" AllowMultiRowSelection="false"
    OnItemDataBound="OnItemDataBoundHandler" OnDetailTableDataBind="RadGridOverview_DetailTableDataBind"
    AllowPaging="True" Skin="Bootstrap" PageSize="30" OnNeedDataSource="RadGridClassOverview_NeedDataSource"
    OnItemCommand="RadGridClassOverview_ItemCommand" OnPreRender="RadGridClassOverview_PreRender" CssClass="table table-striped">
    <PagerStyle Mode="NextPrev" Position="Bottom" PageSizeControlType="RadComboBox"></PagerStyle>
    <MasterTableView AutoGenerateColumns="false" DataKeyNames="Student_reference, Expr1, Group" TableLayout="Auto" RetainExpandStateOnRebind="false" HierarchyLoadMode="ServerBind" EnableHierarchyExpandAll="true" HierarchyDefaultExpanded="false" EditMode="EditForms">
    <DetailTables>
    <telerik:GridTableView AutoGenerateColumns="false" DataKeyNames="note_ref" Width="100%" EnableHierarchyExpandAll="true" CommandItemDisplay="Top" EditMode="EditForms" Name="GridNotes">
    <CommandItemSettings AddNewRecordText="Create New Note" />
    <NoRecordsTemplate>
    <div>
    There are no notes to display
    </div>
    </NoRecordsTemplate>
    <Columns>
    <telerik:GridButtonColumn CommandName="View" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" Text="View" UniqueName="ViewCommandColumn">
    </telerik:GridButtonColumn>
    <telerik:GridButtonColumn CommandName="Edit" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" Text="Edit" UniqueName="EditCommandColumn">
    </telerik:GridButtonColumn>
    <telerik:GridButtonColumn CommandName="Delete" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" Text="Delete" UniqueName="DeleteCommandColumn">
    </telerik:GridButtonColumn>
    <telerik:GridBoundColumn DataField="student_id" HeaderText="student_id" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" UniqueName="Student_ref" Display="false" runat="server" ReadOnly="true">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="note_ref" DataType="System.Int32" HeaderText="note_ref" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" UniqueName="note_ref" Display="False" runat="server" ReadOnly="true">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="course" HeaderText="code" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" UniqueName="course" Display="false" runat="server" ItemStyle-Width="10px" HeaderStyle-Width="10px">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="course_name" HeaderText="Subject" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" UniqueName="qualname" HeaderStyle-Width="200px" ItemStyle-Width="200px" ItemStyle-HorizontalAlign="Left" ItemStyle-Wrap="true">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="noteType" HeaderText="Type" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" UniqueName="noteType" Display="false">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="typeDesc" HeaderText="Note Type" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" UniqueName="typeDesc" ItemStyle-HorizontalAlign="Left" ItemStyle-Wrap="true">
    </telerik:GridBoundColumn>
    <telerik:GridDateTimeColumn DataField="created" HeaderText="Created" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" UniqueName="created" DataFormatString="{0:dd/MM/yyyy}">
    </telerik:GridDateTimeColumn>
    <telerik:GridBoundColumn DataField="created_by" HeaderText="Created" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" UniqueName="created_by" Display="false" ItemStyle-HorizontalAlign="Left">
    </telerik:GridBoundColumn>
    <telerik:GridBoundColumn DataField="note_content" HeaderText="Created" HeaderStyle-BackColor="#428bca" HeaderStyle-ForeColor="White" HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" HeaderStyle-VerticalAlign="Middle" UniqueName="note_content" Display="false" ItemStyle-HorizontalAlign="Center">
    </telerik:GridBoundColumn>
    </Columns>
    <EditFormSettings EditFormType="Template">
    <EditColumn UniqueName="Edit">
    </EditColumn>
    <FormTemplate>
    <table style="width: 85%" border="1">
    <asp:Panel ID="pnlAdd" runat="server" Visible="false">
    <tr style="border: solid">
    <td colspan="2"><b>Create New Note</b><br />
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <asp:Label ID="lblqualcode" runat="server" Text=''></asp:Label>
    <br />
    Select Note Type<br />
    <telerik:RadComboBox ID="RadComboBoxNoteType" runat="server" EmptyMessage="Select NoteType" CausesValidation="False"
    HighlightTemplatedItems="true" Height="100px" Width="450px" DropDownWidth="450px" EnableAutomaticLoadOnDemand="False" AutoPostBack="true"
    AppendDataBoundItems="true" Visible="true" CssClass="ComboBox" OnSelectedIndexChanged="RadComboBoxNoteType_SelectedIndexChanged">
    </telerik:RadComboBox>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <telerik:RadComboBox ID="RadComboBoxQual" runat="server" EmptyMessage="Select Subject and class" CausesValidation="False"
    HighlightTemplatedItems="true" Height="100px" Width="450px" DropDownWidth="450px" EnableAutomaticLoadOnDemand="False" AutoPostBack="true"
    AppendDataBoundItems="true" Visible="true" CssClass="ComboBox">
    </telerik:RadComboBox>
    </td>
    </tr>
    <tr>
    <td colspan="2">Mindset habits<br />
    Please select the mindset habits to link to this note</td>
    </tr>
    <tr>
    <td colspan="2">
    <telerik:RadListBox ID="ListBoxhabits" runat="server" RenderMode="Lightweight" CheckBoxes="true">
    <Items>
    <telerik:RadListBoxItem Text=" Time" />
    <telerik:RadListBoxItem Text=" Engagement" />
    <telerik:RadListBoxItem Text=" Response" />
    <telerik:RadListBoxItem Text=" Resources" />
    <telerik:RadListBoxItem Text=" Organisation" />
    </Items>
    </telerik:RadListBox>
    </td>
    </tr>
    <tr>
    <td colspan="2">Enter Note content
    <br />
    <asp:TextBox ID="txtNoteContent" runat="server" Text="" class="form-control input-normal" Rows="5" Columns="100" TextMode="MultiLine">
    </asp:TextBox><br />
    <br />
    <br />
    <br />
    <asp:Label ID="lblMessage" runat="server" Text=''></asp:Label>
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <asp:Button ID="btnSave" CausesValidation="False" Text="Save"
    runat="server" AutoPostBack="True" CommandName="PerformInsert"></asp:Button>&nbsp;
    </td>
    </tr>
    </asp:Panel>
    <asp:Panel ID="Paneledit" runat="server" Visible="false">
    <tr>
    <td colspan="2">
    <b>Note Details</b><br />
    </td>
    </tr>
    <tr>
    <td colspan="2">Edit Note content
    <br />
    <asp:TextBox ID="txteditnotedets" runat="server" class="form-control input-normal" Rows="5" Columns="100" TextMode='MultiLine' Text='<%# Bind("note_content") %>'>
    </asp:TextBox><br />
    </td>
    </tr>
    <tr>
    <td colspan="2">
    <asp:Button ID="btnUpdate" CausesValidation="False" Text="Save"
    runat="server" AutoPostBack="True" CommandName="PerformUpdate"></asp:Button>&nbsp;
    </td>
    </tr>
    </asp:Panel>
    <asp:Panel ID="Paneldetail" runat="server" Visible="false">
    <tr>
    <td colspan="2">
    <b>Note Details</b><br />
    </td>
    </tr>
    <tr> <td colspan="2">
    <asp:Label ID="LabelEditDetails" runat="server" Text='<%# Bind("note_content") %>'></asp:Label>
    </td>
    </tr>
    </asp:Panel>
    </table>
    </FormTemplate>
    </EditFormSettings>
    </telerik:GridTableView>
    </DetailTables>
    <Columns>

    I want to display panelDetail when I click the View Column and Paneledit when I click the edit column. PanelEdit is displaying correctly but PanelDelete does not work. What do I need to do to get it to work?

Back to Top