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
How do we access view state value of this page in the next page?
Why session management is required?
What is enableviewstate in asp net?
Explain parts of assembly?
What are the advantages and disadvantages of session?
What is global.asax file used for?
How will you load dynamic assembly?
How to disable cut, copy and paste in TextBox using jQuery in asp.net?
What is the difference between custom web user control and a custom web server control?
What is an assembly? Explain its parts.
Describe the master page.
Why mvc is faster than asp.net? : Asp.Net MVC
Explain how cookies work. Give an example of cookie abuse.
How can u debug your .net application?
What’s difference between “optimistic” and “pessimistic” locking?