私はこのようなテーブルを持っており、背後のコードでは、ラベルに一時名のように表示し、ドロップダウンリストに実行日を表示する必要がありますドロップダウンに重複する名前なしで最後の10回の実行日を表示する必要がありますDDLのrundates。どうすればこれを達成できますか??同じためのストアドプロシージャが必要です。
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataTable dt = new DataTable();
dt = Common.rundate();
DropDownList ddl = e.Row.FindControl("DropDownList1") as DropDownList;
ddl.DataTextField = "RunDate";
ddl.DataValueField = "TempID";
ddl.DataSource = dt;
ddl.DataBind();
}
}
public static DataTable rundate()
{
DBAccess objDBAccess = new DBAccess();
DataTable dt = new DataTable();
try
{
objDBAccess.AddParameter("@tempname", SqlDbType.VarChar);
objDBAccess.AddParameter("@tempid", SqlDbType.Int);
objDBAccess.AddParameter("@rundate", SqlDbType.DateTime);
dt = objDBAccess.ExecuteDataTable("display_rundates");
return dt;
}
catch
{
return null;
}
}