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

[Solved] Position edit button on grid

5 Answers 230 Views
Grid
This is a migrated thread and some comments may be shown as answers.
wdudek
Top achievements
Rank 1
wdudek asked on 21 Sep 2009, 04:06 PM
I'm trying to get the edit button to display as the first column on my grid and am having an incredibly hard time doing so. I tried the GridEditCommandColumn, but can't seem to get it to show up. Below is the code for the grid (sorry for the length there are several child grids in it, Right now I am just trying to get the Master grid to have the edit functionality although I will need all of them to do so. I had the grid auto generating the column before but it ended up as the last column and I need it as the first. If anyone can suggest what I am doing wrong or give me a link to a good example that would be great.

Thanks

Bill



  <telerik:RadGrid ID="rgEditor" runat="server"  
        onneeddatasource="rgEditor_NeedDataSource" AllowFilteringByColumn="True"  
        AllowSorting="True" GridLines="None" AutoGenerateColumns="False"  
        Width="100%" Height="770px" AllowAutomaticUpdates="True"  
        onitemupdated="rgEditor_ItemUpdated"  
        onupdatecommand="rgEditor_UpdateCommand"  
        ondetailtabledatabind="rgEditor_DetailTableDataBind"  
    AllowCustomPaging="True" AllowPaging="True" PageSize="15" > 
<MasterTableView CellSpacing="-1" DataKeyNames="HeaderID"  Name="Header" EditMode="InPlace" > 
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
    <DetailTables> 
        <telerik:GridTableView AllowPaging="false" runat="server" DataKeyNames="HeaderID, BillOrShipIndicator" Caption="<b>Address<b/>" Name="Address" CellSpacing="-1" EditMode="InPlace" AllowCustomSorting="false" AllowFilteringByColumn="false"
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px" /> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px" /> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridBoundColumn HeaderText="Bill or Ship" DataField="BillOrShipIndicator" UniqueName="BillOrShipIndicator" HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn HeaderText="Full Name" DataField="FullName" UniqueName="FullName" HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn HeaderText="Address 1" DataField="AddressLine1" UniqueName="AddressLine1" HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn HeaderText="Address 2" DataField="AddressLine2" UniqueName="AddressLine2" HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn HeaderText="City" DataField="City" UniqueName="City" HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn HeaderText="State" DataField="State" UniqueName="State" HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn HeaderText="Country Code" DataField="CountryCode" UniqueName="CountryCode" HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn HeaderText="Zip Code" DataField="ZipCode" UniqueName="ZipCode" HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
            </Columns> 
        </telerik:GridTableView> 
        <telerik:GridTableView runat="server" CellSpacing="-1" DataKeyNames="HeaderID"  
            Caption="<b>Detail</b>" AllowPaging="false" Name="Detail" AllowCustomSorting="false" AllowFilteringByColumn="false"
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px" /> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px" /> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridBoundColumn DataField="ISBN" HeaderText="ISBN" UniqueName="ISBN"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="ISBN13" HeaderText="ISBN 13" UniqueName="ISBN13"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="NetPrice" HeaderText="Net Price" UniqueName="NetPrice"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Quantity" HeaderText="Quantity" UniqueName="Quantity"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="AltTitleCode" HeaderText="Alt Title Code" UniqueName="AltTitleCode"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Discount" HeaderText="Discount" UniqueName="Discount"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="PromotionKey" HeaderText="Promo" UniqueName="PromotionKey"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="FreightTerms" HeaderText="Freight Terms" UniqueName="FreightTerms"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="TitleStatusOverride" HeaderText="Title Status Override" UniqueName="TitleStatusOverride"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="TransportOverride" HeaderText="Transport Override" UniqueName="TransportOverride"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="BackorderCancelOverride" HeaderText="BO Cancel Override" UniqueName="BackorderCancelOverride"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="StatusCode" HeaderText="Status Code" UniqueName="StatusCode"  HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
            </Columns> 
        </telerik:GridTableView> 
        <telerik:GridTableView runat="server" Caption="<b>Instructions</b>" AllowPaging="false" 
            Name="Instructions" AllowCustomSorting="false" AllowFilteringByColumn="false"  
            CellSpacing="-1"
            <RowIndicatorColumn> 
                <HeaderStyle Width="20px" /> 
            </RowIndicatorColumn> 
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px" /> 
            </ExpandCollapseColumn> 
            <Columns> 
                <telerik:GridBoundColumn DataField="AuthorAppearance"  
                    HeaderText="Author Appearance" UniqueName="AuthorAppearance" HeaderStyle-Width="100px"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Instruction1"  
                    HeaderText="Instruction 1" UniqueName="Instruction1" HeaderStyle-Width="100px"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Instruction2"  
                    HeaderText="Instruction 2" UniqueName="Instruction2" HeaderStyle-Width="100px"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Comments1"  
                    HeaderText="Comments 1" UniqueName="Comments1" HeaderStyle-Width="100px"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Comments2"  
                    HeaderText="Comments 2" UniqueName="Comments2" HeaderStyle-Width="100px"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
                <telerik:GridBoundColumn DataField="Comments3"  
                    HeaderText="Comments 3" UniqueName="Comments3" HeaderStyle-Width="100px"
<HeaderStyle Width="100px"></HeaderStyle> 
                </telerik:GridBoundColumn> 
            </Columns> 
        </telerik:GridTableView> 
    </DetailTables> 
<ExpandCollapseColumn Visible="True"
</ExpandCollapseColumn> 
    <Columns> 
<telerik:GridEditCommandColumn UniqueName="EditCommand" ButtonType="LinkButton" EditText="edit" ></telerik:GridEditCommandColumn> 
 
        <telerik:GridBoundColumn DataField="HeaderID" DataType="System.Int64"  
            HeaderText="ID" ReadOnly="False" SortExpression="HeaderID"  
            UniqueName="HeaderID" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="CustomerPurchaseOrder"  
            HeaderText="Customer Purchase Order" ReadOnly="False"  
            SortExpression="CustomerPurchaseOrder" UniqueName="CustomerPurchaseOrder" HeaderStyle-Width="100"
<HeaderStyle Width="100px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ReceiptDate" DataType="System.DateTime"  
            HeaderText="Receipt Date" ReadOnly="False" SortExpression="ReceiptDate"  
            UniqueName="ReceiptDate" HeaderStyle-Width="65"
<HeaderStyle Width="65px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="AccountNumber" DataType="System.Decimal"  
            HeaderText="Account #" ReadOnly="False" SortExpression="AccountNumber"  
            UniqueName="AccountNumber" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ShipToNumber" DataType="System.Decimal"  
            HeaderText="Ship To #" ReadOnly="False" SortExpression="ShipToNumber"  
            UniqueName="ShipToNumber" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="StoreNumber" HeaderText="Store #"  
            ReadOnly="False" SortExpression="StoreNumber" UniqueName="StoreNumber" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="SANSNumber" HeaderText="SAN #"  
            ReadOnly="False" SortExpression="SANSNumber" UniqueName="SANSNumber" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="CustNumber" DataType="System.Decimal"  
            HeaderText="Cust #" ReadOnly="False" SortExpression="CustNumber"  
            UniqueName="CustNumber" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ZipStateCountry"  
            HeaderText="Zip State Country" ReadOnly="False" SortExpression="ZipStateCountry"  
            UniqueName="ZipStateCountry" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ShortName" HeaderText="Short Name"  
            ReadOnly="False" SortExpression="ShortName" UniqueName="ShortName" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ShipVia" HeaderText="Ship Via"  
            ReadOnly="False" SortExpression="ShipVia" UniqueName="ShipVia" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="FreightTerm" HeaderText="Freight Term"  
            ReadOnly="False" SortExpression="FreightTerm" UniqueName="FreightTerm" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ArriveBy" DataType="System.DateTime"  
            HeaderText="Arrive By" ReadOnly="False" SortExpression="ArriveBy"  
            UniqueName="ArriveBy" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DevliverOn" DataType="System.DateTime"  
            HeaderText="Devliver On" ReadOnly="False" SortExpression="DevliverOn"  
            UniqueName="DevliverOn" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="NotBefore" DataType="System.DateTime"  
            HeaderText="Not Before" ReadOnly="False" SortExpression="NotBefore"  
            UniqueName="NotBefore" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Shipon" DataType="System.DateTime"  
            HeaderText="Ship On" ReadOnly="False" SortExpression="Shipon" UniqueName="Shipon" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="OrderSource" HeaderText="Order Source"  
            ReadOnly="False" SortExpression="OrderSource" UniqueName="OrderSource" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="OrderType" HeaderText="Order Type"  
            ReadOnly="False" SortExpression="OrderType" UniqueName="OrderType" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="RushCode" HeaderText="Rush Code"  
            ReadOnly="False" SortExpression="RushCode" UniqueName="RushCode" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="MarkFor" HeaderText="Mark For"  
            ReadOnly="False" SortExpression="MarkFor" UniqueName="MarkFor" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="CartonRound" HeaderText="Carton Round"  
            ReadOnly="False" SortExpression="CartonRound" UniqueName="CartonRound" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="StatusOverride" HeaderText="Status Override"  
            ReadOnly="False" SortExpression="StatusOverride" UniqueName="StatusOverride" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="WarehouseCode" HeaderText="Warehouse Code"  
            ReadOnly="False" SortExpression="WarehouseCode" UniqueName="WarehouseCode" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Royalty" HeaderText="Royalty"  
            ReadOnly="False" SortExpression="Royalty" UniqueName="Royalty" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Facility" HeaderText="Facility"  
            ReadOnly="False" SortExpression="Facility" UniqueName="Facility" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="InvoiceRoute" HeaderText="Invoice Route"  
            ReadOnly="False" SortExpression="InvoiceRoute" UniqueName="InvoiceRoute" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="BOShipDate" DataType="System.DateTime"  
            HeaderText="BOS hip Date" ReadOnly="False" SortExpression="BOShipDate"  
            UniqueName="BOShipDate" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="PrintBindOrderNumber"  
            HeaderText="Print Bind Order #" ReadOnly="False"  
            SortExpression="PrintBindOrderNumber" UniqueName="PrintBindOrderNumber" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ShipWOFlag" HeaderText="Ship WO Flag"  
            ReadOnly="False" SortExpression="ShipWOFlag" UniqueName="ShipWOFlag" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="WorkOrderNumber"  
            HeaderText="Work Order #" ReadOnly="False" SortExpression="WorkOrderNumber"  
            UniqueName="WorkOrderNumber" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="CancelDate" DataType="System.DateTime"  
            HeaderText="Cancel Date" ReadOnly="False" SortExpression="CancelDate"  
            UniqueName="CancelDate" HeaderStyle-Width="65"
<HeaderStyle Width="65px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="CancelDays" DataType="System.Decimal"  
            HeaderText="Cancel Days" ReadOnly="False" SortExpression="CancelDays"  
            UniqueName="CancelDays" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="AdditionalDiscount"  
            DataType="System.Decimal" HeaderText="Addl Discount" ReadOnly="False"  
            SortExpression="AdditionalDiscount" UniqueName="AdditionalDiscount" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Promotion" HeaderText="Promotion"  
            ReadOnly="False" SortExpression="Promotion" UniqueName="Promotion" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="OverrideDiscount" DataType="System.Decimal"  
            HeaderText="Override Disc" ReadOnly="False" SortExpression="OverrideDiscount"  
            UniqueName="OverrideDiscount" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DatingCode" HeaderText="Dating Code"  
            ReadOnly="False" SortExpression="DatingCode" UniqueName="DatingCode" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="OverrideNetPrice" DataType="System.Decimal"  
            HeaderText="Override Net Price" ReadOnly="False" SortExpression="OverrideNetPrice"  
            UniqueName="OverrideNetPrice" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="BOPreference" HeaderText="BO Pref"  
            ReadOnly="False" SortExpression="BOPreference" UniqueName="BOPreference" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="NYPPreference" HeaderText="NYP Pref"  
            ReadOnly="False" SortExpression="NYPPreference" UniqueName="NYPPreference" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="BSBPreference" HeaderText="BSB Pref"  
            ReadOnly="False" SortExpression="BSBPreference" UniqueName="BSBPreference" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="InvoiceCombinePreference"  
            HeaderText="Invoice Combine Pref" ReadOnly="False"  
            SortExpression="InvoiceCombinePreference" UniqueName="InvoiceCombinePreference" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="ClientPONumber" HeaderText="Client PO Number"  
            ReadOnly="False" SortExpression="ClientPONumber" UniqueName="ClientPONumber" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="DupeFlag" HeaderText="Dupe Flag"  
            ReadOnly="False" SortExpression="DupeFlag" UniqueName="DupeFlag" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="StatusCode" DataType="System.Decimal"  
            HeaderText="StatusCode" ReadOnly="False" SortExpression="StatusCode"  
            UniqueName="StatusCode" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="UserID" HeaderText="User ID" ReadOnly="False"  
            SortExpression="UserID" UniqueName="UserID" HeaderStyle-Width="50"
<HeaderStyle Width="50px"></HeaderStyle> 
        </telerik:GridBoundColumn> 
    </Columns> 
</MasterTableView> 
        <ClientSettings> 
            <Scrolling AllowScroll="True" UseStaticHeaders="True" /> 
        </ClientSettings> 
    </telerik:RadGrid> 

5 Answers, 1 is accepted

Sort by
0
Casey
Top achievements
Rank 1
answered on 21 Sep 2009, 05:42 PM
Hello,

Have you tried setting up the first column as a GridTemplateColumn and using a Link Button inside of the ItemTemplate?

<telerik:GridTemplateColumn HeaderText="Edit"   
                    ReadOnly="True" UniqueName="Edit">  
                    <ItemTemplate> 
                        <asp:LinkButton ID="LinkButton1" runat="server" CommandName="Edit">Edit</asp:LinkButton> 
                    </ItemTemplate> 
</telerik:GridTemplateColumn> 

Then in your code for the RadGrid1_ItemCommand event:
protected void RadGrid1_ItemCommand(object source, GridCommandEventArgs e)  
    {  
        if (e.CommandName == "Edit")  
        {  
            //Your code here  
        }  
    } 
0
Sebastian
Telerik team
answered on 22 Sep 2009, 12:29 PM

Hi guys,

If you use declarative column definitions, the order in which you specify the columns in the RadGrid markup should be the same as they are visualized in the browser.

In case you specified auto-generated columns, you can use the SwapColumns server method to switch the place of the first automatically generated column with the GridEditCommandColumn.

Best regards,

Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
wdudek
Top achievements
Rank 1
answered on 22 Sep 2009, 01:57 PM
Sebastian,
    I guess my real question is where can I find an example of using declarative column definitions with an edit button, or to do this do I need to take the approach Casey mentioned?

Thanks

Bill
0
Sebastian
Telerik team
answered on 22 Sep 2009, 02:05 PM
Hello wdudek,

Most of the demos under the Insert/Update/Delete section of the RadControls QSF have declarative set of columns along with GridEditCommandColumn defined in the markup. For example this one:

http://demos.telerik.com/aspnet-ajax/grid/examples/dataediting/alleditablecolumns/defaultcs.aspx

Greetings,
Sebastian
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
wdudek
Top achievements
Rank 1
answered on 24 Sep 2009, 08:05 PM
Thanks for the help everyone, the GridEditCommandColumn wasn't the problem, the fact that I wasn't sizing it turned out to be. It was there I just couldn't see it.
Tags
Grid
Asked by
wdudek
Top achievements
Rank 1
Answers by
Casey
Top achievements
Rank 1
Sebastian
Telerik team
wdudek
Top achievements
Rank 1
Share this question
or