救命啊.我想将数据库中的值绑定到控件的文本框中,但下面的写法是显示对就的字段.我要显示的是该字段对应的值.怎么办啊.高手帮忙.感激不尽.急..
foreach(DataGridItem item in this.LabDataGrid1.Items)
{
((TextBox)(item.Cells[7].Controls[1])).Text = BuyDS.BUYORDERDTL_COUNT_FIELD.ToString();;
((TextBox)(item.Cells[8].Controls[1])).Text = BuyDS.BUYORDERDTL_WEIGHT_FIELD.ToString();
((TextBox)(item.Cells[9].Controls[1])).Text = BuyDS.BUYORDERDTL_UNITPRICE_FIELD.ToString();
}
foreach(DataGridItem item in this.LabDataGrid1.Items)
{
((TextBox)(item.Cells[7].Controls[1])).Text = BuyDS.BUYORDERDTL_COUNT_FIELD.ToString();;
((TextBox)(item.Cells[8].Controls[1])).Text = BuyDS.BUYORDERDTL_WEIGHT_FIELD.ToString();
((TextBox)(item.Cells[9].Controls[1])).Text = BuyDS.BUYORDERDTL_UNITPRICE_FIELD.ToString();
}
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
DataTable dt = CreateData(); (e.Row.FindControl("rdoButtonSex") as RadioButtonList).Items.FindByValue(dt.Rows[e.Row.RowIndex]["Sex"].ToString()).Selected = true;
} if (e.Row.RowType == DataControlRowType.Header)
{
e.Row.Attributes.Add("style", "cursor:pointer;text-decoration:underline;");
e.Row.ID = "Header";
}
}