获取 SelectedValue 值问题
我用:
foreach (TableCell header in this.GridView1.HeaderRow.Cells
DropDownList2.Items.Add(header.Text);
将GridView Header 的字段添加到DropDownList里,然后选择DropDownList的显示的字段怎么获取其SelectValue值啊???!!谢谢!!!
[解决办法]
DropDownList1.SelectItem.text
[解决办法]
this.DropDownList1.SelectedValue
[解决办法]
his.DropDownList1.SelectedValue
[解决办法]
up~~~~~~~
[解决办法]
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.Header)
{
for (int i = 0; i < e.Row.Cells.Count; i++)
{
//键值绑定
ListItem li = new ListItem();
li.Text = e.Row.Cells[i].Text;
li.Value = e.Row.Cells[i].Text;
DropDownList1.Items.Add(li);
}
}
}
//想取DropDownList1的值 现在就直接:
//DropDownList1.SelectedValue 或 DropDownList1.SelectedItem.Value
[解决办法]
//想取DropDownList1的值 现在就直接:
//DropDownList1.SelectedValue 或 DropDownList1.SelectedItem.Value
对的