<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
<telerik:GridEditCommandColumn ButtonType="ImageButton"></telerik:GridEditCommandColumn>http://demos.telerik.com/aspnet-ajax/calendar/examples/datepicker/shareddatepicker/defaultcs.aspx?product=grid
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); }}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(); }}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.
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();
}
}
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?
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
