asp.net - Displaying of the data in the gridview based on the search criteria using generics concept of .net -


i new .net..i have develop asp.net application.

the ui of web page have data-bound grid control on home page , there textbox users can enter search criteria. know using ado.net concept...

but supposed using generics concept.how can store values in generic list or dictionary of .net , filter data based on text entered in text box.

please me out..

thanks in advance..

you can indeed bind gridview list<t>, time, this:

create poco data

public class somedata {   public string somefield {get;set;}   public string someotherfield {get;set;} } 

build list (either manually or result db query) e.g.

var mylist = new list<somedata>(); var myitem = new somedata() {   somefield = "hello",   someotherfield = "world" }; 

to filter data this:

myfilter = mytextbox.value; mylist = mylist.where(somedata => somedata.somefield.equals(myfiltervalue)).tolist(); 

bind gridview

mygridview.datasource = mylist; mygridview.databind(); 

and it!!


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -