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

RadGrid edit mode is not working

7 Answers 723 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Helen
Top achievements
Rank 1
Helen asked on 14 Mar 2012, 06:06 PM
I'm having trouble with my I'm having trouble with my RadGrid - I try show grid in edit mode, but it's not working. I don't know what I miss here. 
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                    </AjaxSettings>
        </telerik:RadAjaxManager>
            
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false"
                    DataSourceID="gridRequest" Edit = "true">
            <MasterTableView EditMode = "InPlace" >
                <Columns>
                    <telerik:GridBoundColumn DataField="Program" HeaderText="Program" ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Organization"  HeaderText="Organization"></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Campaign" HeaderText="Campaign" ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="MinEmployeeCnt" HeaderText="MinEmployeeCnt" ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="MaxEmployeeCnt" HeaderText="MaxEmployeeCnt" ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="MinSalesVolume" HeaderText="MinSalesVolume" ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="MaxSalesVolume" HeaderText="MaxSalesVolume"  ></telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="LandLineOnly" HeaderText="LandLineOnly" ></telerik:GridBoundColumn>
                </Columns>
        </MasterTableView>
    </telerik:RadGrid>
             
    <asp:ObjectDataSource ID="gridRequest" runat="server" SelectMethod="SelectBusiness" TypeName="G2WebBL.DataMappers.LeadsRequest.LeadsRequestDataAccess">
        <SelectParameters><asp:SessionParameter Name="id" DbType="String" DefaultValue="%" SessionField="ID"  /></SelectParameters>
    </asp:ObjectDataSource>
 
</form>

7 Answers, 1 is accepted

Sort by
0
Bruno
Top achievements
Rank 1
answered on 14 Mar 2012, 07:54 PM
add in your columns tag this code
<telerik:GridEditCommandColumn ButtonType="ImageButton">
</telerik:GridEditCommandColumn>
0
Helen
Top achievements
Rank 1
answered on 14 Mar 2012, 08:00 PM
0
Shinu
Top achievements
Rank 2
answered on 15 Mar 2012, 05:32 AM
Hello Helen,

You can put all items in edit mode without using EditColumn in pageload or prerender as shown below. Let me illustrate.
1)PageLoad:
C#:
protected void Page_Load(object sender, EventArgs e)
{
 for (int i = 0; i < RadGrid1.PageSize; i++)
 {
   RadGrid1.EditIndexes.Add(i);
 }
}
2)PreRender:
C#:
protected void RadGrid1_PreRender(object sender, EventArgs e)
{
 if (!IsPostBack)
 {
  foreach (GridItem item in RadGrid1.MasterTableView.Items)
  {
    if (item is GridEditableItem)
    {
      GridEditableItem editableItem = item as GridDataItem;
      editableItem.Edit = true;
    }
  }
   RadGrid1.Rebind();
 }
}
Hope this helps.
NB: I looked into the code and saw Edit=true within Radgrid. I am not sure if such a property exists for Radgrid. Did you get to type that in?

Regards,
Shinu.

0
Helen
Top achievements
Rank 1
answered on 16 Mar 2012, 05:00 PM
It works! Thank you so much for your help!
0
Lee
Top achievements
Rank 1
answered on 12 Jun 2019, 10:56 PM

I know this post is pretty old. I needed the same functionality and got it to work with one issue. Only the last row of a multi row grid has the one field editable. I need all the cells of just one column editable. Any help would be great. Thanks,

                        <telerik:RadGrid ID="RMALineItemsRadGridView" runat="server" Edit = "true"
                            Skin="WebBlue" AutoGenerateColumns="False"
                            CellSpacing="-1" GridLines="Both" OnItemCreated="RMALineItemsRadGridView_ItemCreated" OnPreRender="RMALineItemsRadGridView_PreRender" >
                            <MasterTableView ShowHeadersWhenNoRecords="true" Width="2750px" EditMode="InPlace" >
                                <NoRecordsTemplate>
                                    <div>
                                        There are no records to display
                                    </div>
                                </NoRecordsTemplate>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="SONo" DataType="System.String" HeaderText="SO #"
                                        SortExpression="SONo" UniqueName="SONo" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="SOLineNo" DataType="System.String" HeaderText="SO Line #"
                                        SortExpression="SOLineNo" UniqueName="SOLineNo" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="InvoiceDate" DataType="System.DateTime" DataFormatString="{0:d}" HeaderText="Invoice Date"
                                        SortExpression="InvoiceDate" UniqueName="InvoiceDate" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="InvoiceNo" DataType="System.String" HeaderText="Invoice #"
                                        SortExpression="InvoiceNo" UniqueName="InvoiceNo" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ItemCategory" DataType="System.String" HeaderText="Category"
                                        SortExpression="ItemCategory" UniqueName="ItemCategory" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="150px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="NAVItemNo" DataType="System.String" HeaderText="NAV Item #"
                                        SortExpression="NAVItemNo" UniqueName="NAVItemNo" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Manufacturer" DataType="System.String" HeaderText="Manufacturer"
                                        SortExpression="Manufacturer" UniqueName="Manufacturer" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="150px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ManufacturerPartNo" DataType="System.String" HeaderText="Man Part #"
                                        SortExpression="ManufacturerPartNo" UniqueName="ManufacturerPartNo" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="150px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Description1" DataType="System.String" HeaderText="Description 1"
                                        SortExpression="Description1" UniqueName="Description1" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="400px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Description2" DataType="System.String" HeaderText="Description 2"
                                        SortExpression="Description2" UniqueName="Description2" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="400px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="QTY" DataType="System.String" HeaderText="QTY"
                                        SortExpression="QTY" UniqueName="QTY" Visible="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="UnitCost" DataType="System.Decimal" DataFormatString="{0:C}" HeaderText="Unit Cost"
                                        SortExpression="UnitCost" UniqueName="UnitCost" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="UnitPrice" DataType="System.Decimal" DataFormatString="{0:C}" HeaderText="Unit Price"
                                        SortExpression="UnitPrice" UniqueName="UnitPrice" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ExtCost" DataType="System.Decimal" DataFormatString="{0:C}" HeaderText="Ext Cost"
                                        SortExpression="ExtCost" UniqueName="ExtCost" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ExtPrice" DataType="System.Decimal" DataFormatString="{0:C}" HeaderText="Ext Price"
                                        SortExpression="ExtPrice" UniqueName="ExtPrice" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="GPDollar" DataType="System.Decimal" DataFormatString="{0:C}" HeaderText="GP Dollar"
                                        SortExpression="GPDollar" UniqueName="GPDollar" Visible="true" ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="SupplierID" DataType="System.String" HeaderText="SupplierID"
                                        SortExpression="SupplierID" UniqueName="SupplierID" Visible="true"  ReadOnly="true">
                                        <HeaderStyle Width="100px" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Supplier" DataType="System.String" HeaderText="Supplier"
                                        SortExpression="" UniqueName="" Visible="true"  ReadOnly="true">
                                        <HeaderStyle Width="200px" />
                                    </telerik:GridBoundColumn>


                                    <%-- <telerik:GridBoundColumn datafield="" datatype="System.String" headertext=""
                                    sortexpression="" uniquename="" Visible="true">
                                </telerik:GridBoundColumn>--%>
                                </Columns>
                            </MasterTableView>
                        </telerik:RadGrid>

 

        protected void RMALineItemsRadGridView_PreRender(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                foreach (GridItem item in RMALineItemsRadGridView.MasterTableView.Items)
                {
                    if (item is GridEditableItem)
                    {
                        GridEditableItem editableItem = item as GridDataItem;
                        editableItem.Edit = true;
                    }
                }

                RMALineItemsRadGridView.Rebind();
            }
        }

 

0
Lee
Top achievements
Rank 1
answered on 13 Jun 2019, 03:50 PM

Okay, I found this for the table which makes all rows for the Quantity column editable:

AllowMultiRowEdit="true"

No my problem is that when I change the values for the column and then attempt to loop through the table values I don't get any values. It seems like I have to flip the table out of edit mode. Anyone have any thoughts on that?

0
Peter Milchev
Telerik team
answered on 14 Jun 2019, 01:07 PM
Hello Lee,

You can check the following Code Library that achieves row and column editing: https://www.telerik.com/support/code-library/edit-all-cells-of-a-specific-column-with-radgrid-using-inplace-editing.

Regards,
Peter Milchev
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
Grid
Asked by
Helen
Top achievements
Rank 1
Answers by
Bruno
Top achievements
Rank 1
Helen
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Lee
Top achievements
Rank 1
Lee
Top achievements
Rank 1
Peter Milchev
Telerik team
Share this question
or