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

RadGrid Edit Mode does not work even with AllowAutomaticUpdates

3 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tarkon
Top achievements
Rank 1
Tarkon asked on 10 Nov 2011, 11:05 PM
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!

3 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 11 Nov 2011, 06:03 AM
Hello Tarkon,

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

-Shinu.
0
Tarkon
Top achievements
Rank 1
answered on 11 Nov 2011, 07:38 PM
I'm using this in SharePoint 2010 - could that be a factor?
0
Tarkon
Top achievements
Rank 1
answered on 11 Nov 2011, 08:30 PM
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.
Tags
Grid
Asked by
Tarkon
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Tarkon
Top achievements
Rank 1
Share this question
or