foreach (GridViewRow item in this.GridView2.Rows)
{
string DDL1 = ((DropDownList)item.Cells[1].FindControl("DDLDepotCategoryRM")).SelectedValue;
}
能不能判断DDL1 下拉取值
类似与if(DDL1 .Text=="一级")
{
//然后根据DDL1 上传到sql 的相应类别
string sql = "update ........."
}
但好像 DDL1的变量 不能.Text
应该怎么处理???
{
string DDL1 = ((DropDownList)item.Cells[1].FindControl("DDLDepotCategoryRM")).SelectedValue;
}
能不能判断DDL1 下拉取值
类似与if(DDL1 .Text=="一级")
{
//然后根据DDL1 上传到sql 的相应类别
string sql = "update ........."
}
但好像 DDL1的变量 不能.Text
应该怎么处理???
DDL1.SelectedItem.Value
http://msdn.microsoft.com/zh-cn/library/system.web.ui.webcontrols.dropdownlist_properties.aspx
{
DropDownList DDL1 = (DropDownList)item.FindControl("DDLDepotCategoryRM");
if(DDL1 !=null && DDL1.SelectedItem!=null)
{
Response.Write(DDL1.SelectedItem.Text);
Response.Write(DDL1.SelectedItem.Value);
}
}