Hi,
I am a fresher. i have a problem related to DataGrid .
i have a data grid and i have to place a dropdown in the
datagrid.and i have to retrieve the values from the database
(sqlserver).please tell me any idea about the code.
Answer Posted / ignatius
put the code inCODEFILE
public DataSet PopulateDDList()
{
string sqlString ="select
emp_name,emp_id from emp_current where
emp_des='"+Des.PM+"'";/*ANY*/
SqlDataAdapter ad = new
SqlDataAdapter(sqlString,new log().db);
DataSet ds = new DataSet();
ad.Fill(ds);
return ds;
}
in the follwing aspx
<EditItemTemplate>
<asp:DropDownList id=DropDownList1 runat="server"
DataSource="<%#PopulateDDList()%>" DataTextField="emp_name"
DataValueField="emp_id">
</asp:DropDownList>
</EditItemTemplate>
Actually this is work well
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
What's the use of response.output.write()?
how to retrieve property settings from xml .config file.
What is anonymous authentication?
Explain the Session state management options available with ASP.NET?
What is round trip in asp.net?
Is post back in asp.net?
What are the steps involved to fill a dataset?
How about the security in Activex DLL and Activex EXE ?
What is the difference between ASP.NET Webforms and ASP.NET MVC?
How do we ensure view state has not tampered?
What is the procedure to create the environment for asp.net? : asp.net mvc
what is meant by sitemapnode ?
Explain the use of duration attribute of @outputcache page directive.
Explain the difference between response.redirect vs server.transfer
What is the use of view state?