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


Please Help Members By Posting Answers For Below Questions

Explain about Automatic resource management?

574


Apart from IDE what are the enhancements in asp.net 2.0?

1625


What is the difference between Classic ASP and ASP.Net?

528


ASP.NET 2.0's new membership API used for creating and managing user account is exposed through which 2 clause?

1466


How can you handle unmanaged code exceptions in asp.net?

548






What are cao and sao.

546


Explain diff. Between friend and protected friend?

498


Distinguish between Server-side and Client-side code with its functionality?

624


What is server infrastructure & server components?

782


What is the life cycle of an asp.net page?

526


What is latest version of asp.net mvc? : Asp.Net MVC

477


What is the difference between page.registerclientscriptblock and page.registerstartupscript?

480


Can I stream live content/events?

575


What are the differences between application object and session object?

492


How to prepare culture-specific formatting in .net.

513