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
Is there any limit for query string? Means what is the maximum size?
How many types of triggers are there in update panel?
What is postback pixel?
What is bson in web api?
What is difference between mvc and asp.net? : Asp.Net MVC
What are the types of authentication in asp.net?
What are validator? Name the validation controls in asp.net? How do you disable them?
What is the difference between localization and globalization?
Is asp.net still used?
What is asp.net file?
What are the uses of list view control in Asp.net?
Define the steps to set up validation control.
How does asp page work?
What are the validation controls available in ASP.NET?
What are the steps involved to fill a dataset?