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

Binding Radgrid to generic using NeedDataSource

1 Answer 102 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Minh
Top achievements
Rank 1
Minh asked on 18 Aug 2011, 09:43 PM
Hi,

I was binding the RadGrid using NeedDataSource w/ a generic collection to separate the presentation from data layer. during the binding, I kept receiving a message that points to the column for my DataKeyNames in the MasterTableView - ResultsID

<

 

 

MasterTableView ShowFooter="false" DataKeyNames="ResultsID" EditMode="InPlace"

 

 

 

CommandItemDisplay="TopAndBottom">

...the error points back to my generic collection for this column..the column exists within my code though....is there anything special that I should know?

 

 

 

protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)

 

{

 

 

using (dl = new WellVentDataLayer())

 

{

 

 

BindingList<WellVentEvents> oEvents = dl.GetWellVentEvents();

 

RadGrid1.DataSource = oEvents;

}

 

}

1 Answer, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 19 Aug 2011, 06:31 AM
Hello,

sorry but Please check again ResultsID is exists in you list or not.

Method 1 : Temporary set AutoGenerateColumns="true" and check it display  ResultsID  column or not.
Method 2 :

If(oEvents.Counts > 0)
{
String StrTemp =Convert.ToString(oEvents[0].ResultsID);  // let me know this code line works or gives error.
RadGrid1.DataSource = oEvents;
}

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Minh
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or