This is a migrated thread and some comments may be shown as answers.

Convert ASP.NET GridView

1 Answer 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 15 Jan 2013, 04:57 PM
Do you have a processor that can convert this to a Rad Grid

<asp:GridView ID="grdViewMtgClass" CssClass="grdMeetingSection" runat="server" AutoGenerateColumns="False" Width="100%" OnRowDataBound="grdViewMtgClass_OnRowDataBound"

OnRowCancelingEdit="grdViewMtgClass_OnRowCanceling" OnRowEditing="grdViewMtgClass_OnRowEditing"

OnRowUpdating="grdViewMtgClass_OnRowUpdating" OnRowDeleting="grdViewMtgClass_OnRowDeleting" CellPadding="4" ForeColor="#333333" GridLines="None">

<AlternatingRowStyle BackColor="White" ForeColor="#284775" />

<Columns>

<asp:TemplateField HeaderText="" HeaderStyle-Width="5%">

<ItemTemplate>

<asp:ImageButton ID="imgIndentOut" runat="server" CausesValidation="false" ImageUrl="~/img/larrow.gif" CommandArgument='<%# Eval("MeetingSectionId") %>' OnClick="imgMoveOut_Click" Text="Indent Out" />

<asp:ImageButton ID="imgIndentIn" runat="server" CausesValidation="false" ImageUrl="~/img/rarrow.gif" CommandArgument='<%# Eval("MeetingSectionId") %>' OnClick="imgMoveIn_Click" Text="Indent In" />

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="" Visible="False">

<EditItemTemplate>

<asp:Label ID="MeetingSectionId" runat="server" Text='<%# Bind("MeetingSectionID") %>'></asp:Label>

</EditItemTemplate>

<ItemTemplate>

<asp:Label ID="MeetingSectionId" runat="server" Text='<%# Bind("MeetingSectionID") %>'></asp:Label>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="" ShowHeader="False" Visible="False">

<EditItemTemplate>

<asp:Label ID="lblIndentations" runat="server" Text='<%# Eval("Indentations") %>'></asp:Label>

</EditItemTemplate>

<ItemTemplate>

<asp:Label ID="lblIndentations" runat="server" Text='<%# Bind("Indentations") %>'></asp:Label>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="" HeaderStyle-Width="5%">

<ItemTemplate>

<asp:Label ID="lblNumeral" runat="server" Text=""></asp:Label>

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="Section Name" HeaderStyle-Width="40%">

<ItemTemplate>

<asp:LinkButton ID="lnkEdit" runat="server" CausesValidation="false" CommandName="Edit" Text='<%# GetIndented(Eval("SectionName").ToString(), Eval("Indentations").ToString()) %>'></asp:LinkButton>

</ItemTemplate>

<EditItemTemplate>

<asp:TextBox ID="txtSectionName" runat="server" Text='<%# Eval("SectionName") %>'></asp:TextBox>

</EditItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="" ShowHeader="False">

<ItemTemplate>

<asp:ImageButton ID="imgMoveUp" runat="server" CausesValidation="false" ImageUrl="~/img/uarrow.gif" CommandArgument='<%# Eval("SortOrder") %>' OnClick="imgMoveUp_Click" Text="Move UP" />

<br />

<asp:ImageButton ID="imgMoveDn" runat="server" CausesValidation="false" ImageUrl="~/img/darrow.gif" CommandArgument='<%# Eval("SortOrder") %>' OnClick="imgMoveDn_Click" Text="Move Dn" />

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField HeaderText="" ShowHeader="False">

<ItemTemplate>

<asp:ImageButton ID="imgFiles" runat="server" CausesValidation="false" ImageUrl="~/img/document_pdf.png" CommandArgument='<%# Eval("MeetingSectionId") %>' OnClick="imgFiles_Click" Text="Files" />

</ItemTemplate>

</asp:TemplateField>

<asp:TemplateField ShowHeader="False">

<EditItemTemplate>

<asp:ImageButton ID="imgPermissions" runat="server" CausesValidation="false" ImageUrl="~/img/16_security_lock_open.png" CommandArgument='<%# Eval("MeetingSectionId") %>' OnClick="imgPermissions_Click" Text="Permissions" />

&nbsp;<asp:ImageButton ID="ImageButton1" runat="server" CausesValidation="True" CommandName="Update" ImageUrl="~/img/save.gif" Text="" />

&nbsp;<asp:ImageButton ID="ImageButton2" runat="server" CausesValidation="False" CommandName="Cancel" ImageUrl="~/img/undo.gif" Text="" />

&nbsp;<asp:ImageButton ID="ImageButton3" runat="server" CausesValidation="False" OnClientClick="return confirm('Are you sure you want to delete this line?');" CommandName="Delete" ImageUrl="~/img/x.gif" Text="" />

</EditItemTemplate>

</asp:TemplateField>

</Columns>

<EditRowStyle BackColor="#999999" />

<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />

<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />

<SortedAscendingCellStyle BackColor="#E9E7E2" />

<SortedAscendingHeaderStyle BackColor="#506C8C" />

<SortedDescendingCellStyle BackColor="#FFFDF8" />

<SortedDescendingHeaderStyle BackColor="#6F8DAE" />

</asp:GridView>

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 16 Jan 2013, 06:21 AM
Hi,

You can use the following events in RadGrid as shown below.
aspx:
<telerik:RadGrid ID="RadGrid2" AutoGenerateColumns="false" runat="server"  ondeletecommand="RadGrid2_DeleteCommand"  onupdatecommand="RadGrid2_UpdateCommand" OnItemDataBound="RadGrid2_ItemDataBound" DataSourceID="SqlDataSource2">
 <MasterTableView>
  <Columns>
   <telerik:GridTemplateColumn>
       <ItemTemplate>
            <asp:Button ID="Button2" runat="server" Text="edit" CommandName="Edit" />
       </ItemTemplate>
       <EditItemTemplate>
         <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
       </EditItemTemplate>
    </telerik:GridTemplateColumn>
     <telerik:GridBoundColumn DataField="Id" UniqueName="Id"></telerik:GridBoundColumn>
   </Columns>
 </MasterTableView>
</telerik:RadGrid>

Thanks,
Princy
Tags
Grid
Asked by
Thomas
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Share this question
or