tags:

views:

12

answers:

1

Hello,

Im trying to create LinqDataSource that will represent data from dynamically created String list and then use it as a datasource to my GridView.

List<string> users = RetreiveUsers();
LinqDataSource ds = new LinqDataSource();

and what now ?

thanks for help.

A: 

I don´t know if you are "drawing" this in markup or not, either way you need to add an eventhandler for the selecting event on the datasource. Something like this:

protected void LinqDS_Selecting(object sender, LinqDataSourceSelectEventArgs e)
{
  e.Result = RetrieveUsers();
}

and then you would have to assign the linq datasource as the datasource of the gridview plus databind the gridview.

Johan Leino