CPK_2011 CPK_2011 - 2 months ago 51
ASP.NET (C#) Question

Telerik RadGrid with Button Column and Databind

I have a table with certain rows and columns. I need to use Dataset to Databind the Telerik RadGrid. Along with this, I need to display extra button column at the end. How can I achieve that? Could you please provide me simple example with Telerik tags in aspx and Databind.

Answer

I use it in my app. You need to add MasterTableView in Your RadGrid and define your buttons.

<MasterTableView
                AllowPaging="true"
                PageSize="15"
                DataKeyNames="ID"
                EditMode="PopUp"

                CommandItemDisplay="Top"
                AllowFilteringByColumn="false">


                <Columns>
                    <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" ButtonType="ImageButton">
                    </telerik:GridEditCommandColumn>
                    <telerik:GridBoundColumn DataField="ID" HeaderText="ID" Display="false"/>
                    <telerik:GridBoundColumn DataField="DOKUMENT_DANEID" HeaderText="DOKUMENT_DANEID" Display="false"/>
                    <telerik:GridBoundColumn DataField="DOKUMENT_TYPEID" HeaderText="DOKUMENT_DANEID" Display="false"/>
                    <telerik:GridBoundColumn DataField="NAME" HeaderText="<%$Resources:Resource, grid_dok_name %>"/>
                    <telerik:GridBoundColumn DataField="TYPe" HeaderText="<%$Resources:Resource, grid_dok_type %>"/>
                    <telerik:GridBoundColumn DataField="DESC" HeaderText="<%$Resources:Resource, grid_dok_desc %>"/>
                    <telerik:GridBoundColumn DataField="PATH" HeaderText="<%$Resources:Resource, grid_dok_plik %>"/>
                    <telerik:GridButtonColumn DataTextFormatString="Select {0}"
                                              ButtonType="ImageButton" HeaderText="<%$Resources:Resource, grid_dok_atta %>"
                                              ItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center"
                                              DataTextField="Open" CommandName="Select" ImageUrl="~\images\App\download.png">
                    </telerik:GridButtonColumn>
                    <telerik:GridButtonColumn UniqueName="DeleteColumn" ButtonType="ImageButton" CommandName="Delete">
                    </telerik:GridButtonColumn>
                </Columns>
                <EditFormSettings UserControlName="../forms/dok_item.ascx" PopUpSettings-Width="380px" EditFormType="WebUserControl">
                    <EditColumn UniqueName="EditCommandColumn1">
                    </EditColumn>
                </EditFormSettings>


            </MasterTableView>