我使用了以下方法让第一个项目为选中状态,但是这样不行,谁能教教我啊。代码:
void Page_Load(object sender, EventArgs e)
{ if (!IsPostBack)
{
DropDownList1.Items ["0"].Selected ;
}
}在第一个项目没有处于选中状态的时候,我使用了以下代码,经过调试,“DropDownList1.SelectedItem”的值为Null。代码:void Page_Load(object sender, EventArgs e)
{ string str=DropDownList1.SelectedItem.value;
}
void Page_Load(object sender, EventArgs e)
{ if (!IsPostBack)
{
DropDownList1.Items ["0"].Selected ;
}
}在第一个项目没有处于选中状态的时候,我使用了以下代码,经过调试,“DropDownList1.SelectedItem”的值为Null。代码:void Page_Load(object sender, EventArgs e)
{ string str=DropDownList1.SelectedItem.value;
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货