0

I am trying to use LinqDataSource instead of using the SQL dataset.

Currently, if I want to update my GridView, I just declare a

DataSet ds = new DataSet();

then I

adapter.Fill(ds);
GridView.DataSource = ds;
GridView.DataBind();

What is the equivalent code using LinqDataSource to update my GridView? Thanks.

user776676
  • 4,265
  • 13
  • 58
  • 77

1 Answers1

1

i assume you using datacontext then this example might help you

  using(MyDataContext ctx = new MyDataContext(){
  this.MyGridView.DataSource = from something in ctx.Somethings where something.SomeProperty == someValue select something;
  this.MyGridView.DataBind();
}
FosterZ
  • 3,863
  • 6
  • 38
  • 62