Hi Kishore.......
If u want to populate Drop Down Dynamically
First U need to write the Stored Procedure In Data Base and
second thing U need to write the Populate method in Presentation Layer and
3rd is u need to write code in DataAccess Layer to data from DataBase
code for Presentation Layer is
private void PopulateDropDown()
{
//daStdent is DataAccessLayer Name and next daStdent is DataAccess class name
daStudent.daStudent objUser = new daStudent.daStudent();
//GetStudentListInfo is stored procedure
DataTable dtStudentList = objUser.GetStudentListInfo(connectionString);
int nTotalRecords = dtStudentList.Rows.Count;
for (int i = 0; i < nTotalRecords; i++)
{
//GVDDL is drop down box name
GVDDL.Items.Add(dtStudentList.Rows[i]["LastName"].ToString());
}
}
code for DataAccessLayer
public DataTable GetStudentListInfo(string ConnectionString)
{
//int LastName
// Set up parameters in parameter array
SqlParameter[] arParms = new SqlParameter[1];
//arParms[0] = new SqlParameter("@LastName", SqlDbType.NVarChar);
// arParms[0].Value = LastName;
pTransactionSuccessful = true;
DataTable dtStudentList = new DataTable("StudentList");
try
{
DataSet dsStudentList =
SqlHelper.ExecuteDataset(ConnectionString, CommandType.StoredProcedure,
"GetStudentListInfo", arParms);
dtStudentList = dsStudentList.Tables[0];
}
catch (SqlException ReadError)
{
pErrorMessage = ReadError.Message.ToString();
pErrorNumber = ReadError.Number;
pErrorClass = ReadError.Class;
pErrorState = ReadError.State;
pErrorLineNumber = ReadError.LineNumber;
pTransactionSuccessful = false;
}
return dtStudentList;
}
If u still unable to do give me a reply with the error.........