asp.net - How do I populate gridview based on dropdownlist selected value using C#? -


i need populate grid based on dropdownlist selected value: c# coding is

protected void atddroplist_selectedindexchanged(object sender, eventargs e) {       empatdlistbi c = new empatdlistbi();       dbconnection b = new dbconnection();       sqldataadapter da = new sqldataadapter();       datatable dt = new datatable();       dataset ds = new dataset();         if (atddroplist.selectedindex == 1)       {          b.openconnection();          dt = c.loadrecords(emptext.text);          gridview1.datasource = dt;          gridview1.databind();          b.closeconnection();       } } 

with coding iam unable see grid in output. please me out

we can check few things
- autopostback of dropdown set true
- getting data in dt
- if necessary can put grid in updatepanel on page


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

c# - must be a non-abstract type with a public parameterless constructor in redis -

ajax - PHP/JSON Login script (Twitter style) not setting sessions -