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

The code now return   values when I update a row

2 Answers 13 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Sylvain Guay
Top achievements
Rank 1
Sylvain Guay asked on 28 Sep 2013, 08:01 PM
Hi, I have this code

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="datagrid.aspx.cs" Inherits="ManageEDI.datagrid" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
 
<%@ Register assembly="Telerik.OpenAccess.Web.40" namespace="Telerik.OpenAccess.Web" tagprefix="telerik" %>
 
<!DOCTYPE html>
 
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManagerAll" runat="server">
        </telerik:RadScriptManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"></telerik:RadAjaxManager>
    <div>
         
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateEditColumn="True" CellSpacing="0" DataSourceID="OpenAccessLinqDataSource1" GridLines="None" OnUpdateCommand="RadGrid1_UpdateCommand" OnItemUpdated="RadGrid1_ItemUpdated">
<ExportSettings>
<Pdf>
<PageHeader>
<LeftCell Text=""></LeftCell>
 
<MiddleCell Text=""></MiddleCell>
 
<RightCell Text=""></RightCell>
</PageHeader>
 
<PageFooter>
<LeftCell Text=""></LeftCell>
 
<MiddleCell Text=""></MiddleCell>
 
<RightCell Text=""></RightCell>
</PageFooter>
</Pdf>
</ExportSettings>
 
<MasterTableView AutoGenerateColumns="False" DataKeyNames="EdiID" DataSourceID="OpenAccessLinqDataSource1" EditMode="InPlace">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
 
<RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
 
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column" Created="True">
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
 
    <Columns>
        <telerik:GridBoundColumn DataField="Status" DataType="System.Int32" FilterControlAltText="Filter Status column" HeaderText="Status" SortExpression="Status" UniqueName="Status">
            <ColumnValidationSettings>
                <ModelErrorMessage Text="" />
            </ColumnValidationSettings>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="NoApl" FilterControlAltText="Filter NoApl column" HeaderText="NoApl" SortExpression="NoApl" UniqueName="NoApl">
            <ColumnValidationSettings>
                <ModelErrorMessage Text="" />
            </ColumnValidationSettings>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="ETA" DataType="System.DateTime" FilterControlAltText="Filter ETA column" HeaderText="ETA" SortExpression="ETA" UniqueName="ETA">
            <ColumnValidationSettings>
                <ModelErrorMessage Text="" />
            </ColumnValidationSettings>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="Note" FilterControlAltText="Filter Note column" HeaderText="Note" SortExpression="Note" UniqueName="Note">
            <ColumnValidationSettings>
                <ModelErrorMessage Text="" />
            </ColumnValidationSettings>
        </telerik:GridBoundColumn>
        
        <telerik:GridBoundColumn DataField="CommandeID" DataType="System.Int32" FilterControlAltText="Filter CommandeID column" HeaderText="CommandeID" SortExpression="CommandeID" UniqueName="CommandeID">
            <ColumnValidationSettings>
                <ModelErrorMessage Text="" />
            </ColumnValidationSettings>
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="EdiID" DataType="System.Int32" FilterControlAltText="Filter EdiID column" HeaderText="EdiID" ReadOnly="True" SortExpression="EdiID" UniqueName="EdiID">
            <ColumnValidationSettings>
                <ModelErrorMessage Text="" />
            </ColumnValidationSettings>
        </telerik:GridBoundColumn>
        
    </Columns>
 
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
</EditFormSettings>
 
<BatchEditingSettings EditType="Cell"></BatchEditingSettings>
 
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
</MasterTableView>
 
<PagerStyle PageSizeControlType="RadComboBox"></PagerStyle>
 
<FilterMenu EnableImageSprites="False"></FilterMenu>
        </telerik:RadGrid>
        <telerik:OpenAccessLinqDataSource ID="OpenAccessLinqDataSource1" runat="server" ContextTypeName="ManageEDIModel.EntitiesModelLegare" EntityTypeName="" ResourceSetName="tblEDIs">
        </telerik:OpenAccessLinqDataSource>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:LEGAREConnection %>" SelectCommand="ListEDI" SelectCommandType="StoredProcedure"></asp:SqlDataSource>
    </div>
    </form>
</body>
</html>

and
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using ManageEDIModel;
using Telerik.Web.UI.GridExcelBuilder;
using Xceed.FileSystem;
using Xceed.Ftp;
 
namespace ManageEDI
{
    public partial class datagrid : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
 
        }
 
        protected void RadGrid1_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
        {
            GridEditableItem editedItem = e.Item as GridEditableItem;
            string c = editedItem["CommandeID"].Text;
            string a = editedItem["NoApl"].Text;
        }
 
        protected void RadGrid1_ItemUpdated(object sender, GridUpdatedEventArgs e)
        {
 
        }
    }
}

When I update the row, the values ​​c and a equal &nbsp;.   

Thank for your answers..




2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 1
answered on 30 Sep 2013, 04:33 AM
Hi,

Please try accessing the fields in edit form as shown below.

C#:
protected void RadGrid1_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
      GridEditableItem editedItem = e.Item as GridEditableItem;
      string c=(editedItem ["CommandeID"].Controls[0] as TextBox).Text;
      string a=(editedItem ["NoApl"].Controls[0] as TextBox).Text;
             
}

Thanks,
Princy.
0
Sylvain Guay
Top achievements
Rank 1
answered on 02 Oct 2013, 02:08 PM
Thank you
 I
t works great..

Wow.. it's a good support...

Merci..
Tags
Grid
Asked by
Sylvain Guay
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 1
Sylvain Guay
Top achievements
Rank 1
Share this question
or