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

Problem Putting a grid into edit mode programatically

1 Answer 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tim
Top achievements
Rank 1
Tim asked on 29 Aug 2011, 03:44 PM
Hi

I am seeing a problem when I attempt to put one of my grids into edit mode.

The grid is defined as follows:

 

 

<telerik:RadGrid ID="ColumnRadGrid" runat="server"

 

 

 

AllowAutomaticUpdates="True"

 

 

 

AllowFilteringByColumn="false"

 

 

 

AllowMultiRowSelection="true"

 

 

 

AllowSorting="false"

 

 

 

AutoGenerateColumns="false"

 

 

 

ClientSettings-AllowColumnsReorder="false"

 

 

 

Height="100%"

 

 

 

OnItemCreated="ColumnRadGrid_ItemCreated"

 

 

 

OnItemUpdated="ColumnRadGrid_ItemUpdated"

 

 

 

OnNeedDataSource="ColumnRadGrid_NeedDataSource"

 

 

 

ShowHeader="true"

 

 

 

TabIndex="6"

 

 

 

Visible="True"

 

 

 

Width="100%">

 

 

 

<ClientSettings AllowKeyboardNavigation="true" EnableRowHoverStyle="false" >

 

 

 

<Selecting AllowRowSelect="True" />

 

 

 

<ClientEvents OnRowDblClick="ColumnRowDblClick" OnRowClick="RowClick"

 

 

 

OnGridCreated="GridCreated" OnCommand="GridCommand" />

 

 

 

<Scrolling AllowScroll="True" UseStaticHeaders="True" />

 

 

 

</ClientSettings>

 

 

 

 

<MasterTableView BorderWidth="1" EditMode="InPlace" GridLines="Vertical" TableLayout="Fixed" Height="100%" Width="100%">

 

 

 

 

<Columns>

 

 

 

<telerik:GridBoundColumn

 

 

 

DataField="ColumnName"

 

 

 

HeaderText="Data Field"

 

 

 

ItemStyle-Wrap="False"

 

 

 

ReadOnly="True"

 

 

 

UniqueName="columnName" >

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridBoundColumn

 

 

 

ColumnEditorID="GridTextBoxColumnEditor"

 

 

 

DataField="Alias"

 

 

 

HeaderText="Column Alias"

 

 

 

ItemStyle-Wrap="False"

 

 

 

UniqueName="columnAlias" >

 

 

 

</telerik:GridBoundColumn>

 

 

 

<telerik:GridTemplateColumn

 

 

 

HeaderStyle-Width="100px"

 

 

 

HeaderText="Show Option"

 

 

 

ItemStyle-Width="100px"

 

 

 

ItemStyle-Wrap="False"

 

 

 

UniqueName="showOption" >

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="ColumnRadGridShowLabel" runat="server" Text='<%#Eval("ShowText") %>' ClientIDMode="Static">

 

 

 

</asp:Label>

 

 

 

</ItemTemplate>

 

 

 

<EditItemTemplate>

 

 

 

<telerik:RadComboBox ID="ColumnRadGridShowComboBox" runat="server" ClientIDMode="Static" Width="90px">

 

 

 

</telerik:RadComboBox>

 

 

 

</EditItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

<telerik:GridTemplateColumn

 

 

 

HeaderStyle-Width="135px"

 

 

 

HeaderText="Sort Option"

 

 

 

ItemStyle-Width="135px"

 

 

 

ItemStyle-Wrap="False"

 

 

 

UniqueName="sortOption" >

 

 

 

<ItemTemplate>

 

 

 

<asp:Label ID="ColumnRadGridSortLabel" runat="server" Text='<%#Eval("SortText") %>' ClientIDMode="Static">

 

 

 

</asp:Label>

 

 

 

</ItemTemplate>

 

 

 

<EditItemTemplate>

 

 

 

<telerik:RadComboBox ID="ColumnRadGridSortComboBox" runat="server" ClientIDMode="Static" Width="125px">

 

 

 

</telerik:RadComboBox>

 

 

 

</EditItemTemplate>

 

 

 

</telerik:GridTemplateColumn>

 

 

 

</Columns>

 

 

 

</MasterTableView>

 

 

 

</telerik:RadGrid>

 

 

 

 

<telerik:GridTextBoxColumnEditor ID="GridTextBoxColumnEditor" runat="server" TextBoxStyle-Width="165px" />

 


I have followed your example on double-clicking a grid row and putting it into edit mode.
This part of the problem I have working.

The following part however is giving me problems.

Our UI requires I have and 'Edit' Image button outside the grid, and clicking this UI element
should put the selected row into edit mode.

It does, briefly. Then I get a post-back or something and the row reverts to uneditable.

I am using the same client-side call as works in my row double click event.

One more thing. This UI is inside an aspx file that I am referencing in a RadWindow.

What am I missing????    

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 01 Sep 2011, 09:35 AM
Hello Tim,

I have followed your scenario and prepared a sample project for you demonstrating how the desired functionality can be implemented. You can find it attached to this message.

I hope it helps.

Best wishes,
Mira
the Telerik team

Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

Tags
Grid
Asked by
Tim
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or