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

Row editing problem on double click

2 Answers 149 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Babu Puchakayala
Top achievements
Rank 1
Babu Puchakayala asked on 11 Jun 2010, 04:12 PM
Hi,

I getting strange error on row edit.
1. I implemented inline row edit on double click. But the row is editing in "Form Template Edit Form". I want only inline line edit. How do it. I am doing something but  I am unable to get it. Can anyone help me.

here is java script.

function RowDblClick(sender, eventArgs) { 
            editedRow = eventArgs.get_itemIndexHierarchical(); 
            $find("<%= gvCktMap.MasterTableView.ClientID %>").editItem(editedRow); 
        } 
 
        function GridCommand(sender, args) { 
            if (args.get_commandName() != "Edit") { 
                editedRow = null
            } 
        } 
 
        function GridCreated(sender, eventArgs) { 
            var gridElement = sender.get_element(); 
            var elementsToUse = []; 
            inputs = gridElement.getElementsByTagName("input"); 
            for (var i = 0; i < inputs.length; i++) { 
                var lowerType = inputs[i].type.toLowerCase(); 
                if (lowerType == "hidden" || lowerType == "button") { 
                    continue; 
                } 
 
                Array.add(elementsToUse, inputs[i]); 
                inputs[i].onchange = TrackChanges
            } 
 
            dropdowns = gridElement.getElementsByTagName("select"); 
            for (var i = 0; i < dropdowns.length; i++) { 
                dropdowns[i].onchange = TrackChanges
            } 
 
            setTimeout(function() { if (elementsToUse[0]) elementsToUse[0].focus(); }, 100); 
        } 
 
 
 

Radgrid

<telerik:RadGrid ID="gvCktMap" BorderColor="White" runat="server" AutoGenerateColumns="true" 
                                AllowSorting="true" BackColor="White" AllowPaging="true" PageSize="25" GridLines="None" 
                                OnPageIndexChanging="gvCktMap_PageIndexChanging" OnRowCancelingEdit="gvCktMap_RowCancelingEdit" 
                                OnRowCommand="gvCktMap_RowCommand" OnRowUpdating="gvCktMap_RowUpdating" OnRowDataBound="gvCktMap_RowDataBound" 
                                OnSorting="gvCktMap_Sorting" OnRowEditing="gvCktMap_RowEditing" ShowGroupPanel="True" 
                                EnableHeaderContextMenu="true" EnableHeaderContextFilterMenu="true" AllowMultiRowSelection="true" 
                                AllowFilteringByColumn="True" AllowCustomPaging="false" OnItemCreated="gvCktMap_ItemCreated" 
                                EnableViewState="false" OnNeedDataSource="gvCktMap_NeedDataSource" OnItemUpdated="gvCktMap_ItemUpdated"
                                <MasterTableView DataKeyNames="sId"
                                </MasterTableView> 
                                     
                                 
                                <ClientSettings ReorderColumnsOnClient="True" AllowDragToGroup="True" AllowColumnsReorder="True"
                                    <ClientEvents OnRowClick="RowClick" OnRowDblClick="RowDblClick" OnGridCreated="GridCreated" 
                                        OnCommand="GridCommand" /> 
                                    <Scrolling AllowScroll="true" UseStaticHeaders="true" /> 
                                    <Selecting AllowRowSelect="True"></Selecting> 
                                    <Resizing AllowRowResize="True" AllowColumnResize="True" EnableRealTimeResize="True" 
                                        ResizeGridOnColumnResize="False"></Resizing> 
                                </ClientSettings> 
                                <GroupingSettings ShowUnGroupButton="true" /> 
                                <PagerStyle Mode="NextPrevAndNumeric" HorizontalAlign="Right" Font-Bold="true" AlwaysVisible="true" /> 
                            </telerik:RadGrid> 

2. I want to give few columns to edit. For ex. i have columns a, b, c, d, e, f, g.  When user double click on a row the user should get e, f, g columns to edit.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 15 Jun 2010, 01:28 PM
Hello Babu,

1.
Set the property MasterTableView  ->  EditMode="InPlace" in order to open inline editmode.

2.
Set the ReadOnly property of column to True in order to prevent the user from editing that particular column. You can add the code for that ColumnCreated event.

C#:
 
    protected void RadGrid1_ColumnCreated(object sender, GridColumnCreatedEventArgs e)  
    {  
        if (e.Column.UniqueName == "CustomerID")  
        {  
            (e.Column as GridBoundColumn).ReadOnly = true;  
        }  
    } 

Thanks,
Princy.
0
Babu Puchakayala
Top achievements
Rank 1
answered on 15 Jun 2010, 06:05 PM
Hi Princy,

Thanks. Thats working great.
Tags
Grid
Asked by
Babu Puchakayala
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Babu Puchakayala
Top achievements
Rank 1
Share this question
or