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

RadGrid Set Column Navigation Property

1 Answer 207 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Ricardo
Top achievements
Rank 1
Ricardo asked on 09 Aug 2011, 11:02 AM
Hello people...

I'm having a problem with my RadGrid...Can you show me how can i on my asp.cs file(code behind) set the column value of my grid with a navigation property field?
RadGrid1.DataSource = this.SapDocuments;
            RadGrid1.
            RadGrid1.UniqueID.Equals("Process") =
public List<SapDocuments> GetSapDocumentsByUser(string userName)
        {
var documentsQuery = from sd in spDocs.SapDocuments
                                     join ua in spDocs.UsersAssign
                                     on new { sd.Staging.Process, sd.Priorities.Priority }
                                     equals
                                     new { ua.Process, ua.Priority }
                                     where ua.UserName == userName
  
                                     //ALterar User
  
                                     select sd;
  
  
            return documentsQuery.ToList();
        }
  
    }
  
    }

I'm using Entity, and I have the a table SapDocuments with a foreign Key of the field Process to another Table "Staging",

At this moment my grid comes with Priority and Stagin values at null and the others are fine...

<MasterTableView GridLines="None" Width="100%" ViewStateMode="Disabled" CommandItemSettings-ShowExportToCsvButton="True"
                CommandItemSettings-ShowAddNewRecordButton="false" CommandItemDisplay="Top">
                <Columns>
                    <telerik:GridBoundColumn DataField="SequencialNumber" HeaderText="SequencialNumber"
                        UniqueName="SequencialNumber" SortExpression="SequencialNumber">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn  DataField="Priority" HeaderText="Priority" UniqueName="Priority"
                        FilterControlAltText="Filter Priority column" SortExpression="Priority" DataType="System.Int32">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn DataField="Process" HeaderText="Staging" UniqueName="Process"
                        SortExpression="Process" FilterControlAltText="Filter Process column">
                    </telerik:GridBoundColumn>


I need to set those two column values with the value of my navigation property....I can access to it like that:

SapDocuments.Staging.Process;
SapDocuments.Priorities.Priority;

I needed to change my datamodel and know i have the exception for Priority and Process :

 {"The ObjectContext instance has been disposed and can no longer be used for operations that require a connection."}

I have already set LazyLoad enabled...

1 Answer, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 12 Aug 2011, 08:55 AM
Hello Ricardo,

The problem which you describe is not directly related to RadGrid, from what I understand it will also replicate with an asp GridView. Therefore, I would advise you to google for a solution to the problem. A couple of threads that could help you are:
http://forums.asp.net/t/1616574.aspx/
http://stackoverflow.com/questions/4206634/

Best wishes,
Tsvetina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Ricardo
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or