RadGrid Edit Mode does not work even with AllowAutomaticUpdates

4 posts, 0 answers
  1. Tarkon
    Tarkon avatar
    17 posts
    Member since:
    Aug 2007

    Posted 10 Nov 2011 Link to this post

    Hi,

    I'm having trouble with my RadGrid - whenever I try editing an item the row isn't put into edit mode and instead all the data is lost from the Grid.  I have AllowAutomaticUpdates set to true, and am using the NeedDataSource method.

    My aspx code:
    <telerik:RadGrid ID="SubmittedApplicantsRadGrid" runat="server" GridLines="Both" AutoGenerateColumns="False" OnNeedDataSource="SubmittedApplicantsRadGrid_NeedDataSource" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true">
        <ValidationSettings ValidationGroup="SubmittedApplicants"></ValidationSettings>
        <MasterTableView DataKeyNames="Id" EditMode="InPlace" CommandItemDisplay="None" NoMasterRecordsText="No applicants submitted to this job">
        <Columns>       
            <telerik:GridBoundColumn DataField="ApplicantName.Title" DataType="System.String" ReadOnly="true" HeaderText="Name" UniqueName="Name"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="PayRate" DataType="System.Double" DataFormatString="{0:C}" ReadOnly="true" HeaderText="Pay Rate" UniqueName="PayRate"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="BillRate" DataType="System.Double" DataFormatString="{0:C}" ReadOnly="true" HeaderText="Bill Rate" UniqueName="BillRate"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ApplicantName.Class" DataType="System.String" ReadOnly="true" HeaderText="Employee Class" UniqueName="Class"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SubmittedBy.Title" DataType="System.String" ReadOnly="true" HeaderText="Submitted By" UniqueName="SubmittedBy"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="SubmittedDate" DataType="System.DateTime"  ReadOnly="true" HeaderText="Submitted On" UniqueName="SubmittedDate"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ForwardedBy.Title" DataType="System.String" ReadOnly="true" HeaderText="Forwarded By" UniqueName="ForwardedBy"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="ForwardedDate" DataType="System.DateTime" ReadOnly="false" HeaderText="Forwarded On" UniqueName="ForwardedDate"></telerik:GridBoundColumn>
            <telerik:GridCheckBoxColumn DataField="Interviewed" DataType="System.Boolean" ReadOnly="false" HeaderText="Interviewed?" UniqueName="Interviewed"></telerik:GridCheckBoxColumn>
     
            <telerik:GridEditCommandColumn ButtonType="ImageButton">
                <ItemStyle Wrap="False" Width="28px" />
            </telerik:GridEditCommandColumn>
        </Columns>
     
        <EditFormSettings>
            <EditColumn UniqueName="EditCommandColumn1"></EditColumn>
        </EditFormSettings>
        </MasterTableView>
    </telerik:RadGrid>

    And my C# code:
    protected void SubmittedApplicantsRadGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
    {
        EntityList<ApplicantsSubmittedJobsItem> ApplicantsSubmittedJobs = data.GetList<ApplicantsSubmittedJobsItem>("ApplicantsSubmittedJobs");
     
        var applicantSubmittedJobs = from applicantSubmittedJob in ApplicantsSubmittedJobs
                                     select applicantSubmittedJob;
     
        SubmittedApplicantsRadGrid.DataSource = applicantSubmittedJobs;
    }

    Any help you could provide would be much appreciated.

    Thanks!
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Nov 2011 Link to this post

    Hello Tarkon,

    I tried the same scenario, but no avail. Check the following demo which implements the same.
    Grid / Entity Framework Operations

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Tarkon
    Tarkon avatar
    17 posts
    Member since:
    Aug 2007

    Posted 11 Nov 2011 Link to this post

    I'm using this in SharePoint 2010 - could that be a factor?
  5. Tarkon
    Tarkon avatar
    17 posts
    Member since:
    Aug 2007

    Posted 11 Nov 2011 Link to this post

    I fixed it - the error was my own.  I forgot to put one of my required variables in the viewstate, so it was lost on postback.  Sorry :(  Thanks for your time.
Back to Top