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.



Hi, I am a fresher. i have a problem related to DataGrid . i have a data grid and i have to place..

Answer / 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

More ASP.NET Interview Questions

Can you edit data in the Repeater control?

11 Answers   CAC, Creative,


What is ViewState ? and how it is managed ?

1 Answers  


Which .NET framework supports Web API?

0 Answers  


What are the advantages and disadvantages of viewstate ?

1 Answers  


Describe the role of inetinfo.exe, aspnet_isapi.dll andaspnet_wp.exe

1 Answers  






Describe session handling in a webfarm?

0 Answers  


# What is the transport protocol you use to call a Web service?

1 Answers  


How many validators do ASP.NET have?

0 Answers   QuestPond,


What are the different validators in asp.net?

0 Answers  


What is reflection and disadvantages of reflection ?

2 Answers   CTC, Microsoft,


Where session variables are stored?

0 Answers  


What is Web Application?

2 Answers   HCL,


Categories