我有一个 GridView,我想将第一个 Column(teachername) 与我在 GridView 之外的 DropDownList 绑定。我怎样才能让它工作?
protected void Button2_Click(object sender, EventArgs e)
{
string q = "select * from teacher where teachername='" + drpteachername.SelectedItem.ToString() + "' and ('2013-03-01' between date and todate) and '2013-03-31' between date and todate";
dt = dbo.Getdt(q);
GridView1.DataSource = dt;
GridView1.DataBind();
string teachername=drpteachername.SelectedItem.ToString();
for (int i = 0; i < dt.Rows.Count ;i++ )
{
Label lblteachername = (Label)GridView1.Rows[i].Cells[0].FindControl("lblgridteachername");
this.GridView1.Rows[i].Cells[0].Value = teachername;
}
}