DropDownList 是数据库绑定的数据!
if (DropDownList.SelectedValue == "次数卡")
{
JCK.Style["Display"] = "Block";//显示
QTLX.Style["Display"] = "None";//隐藏
} 现在这行代码无法实现需要的效果! 需要从DropDownList 里面取值在做判断显示DIV的层!
if (DropDownList.SelectedValue == "次数卡")
{
JCK.Style["Display"] = "Block";//显示
QTLX.Style["Display"] = "None";//隐藏
} 现在这行代码无法实现需要的效果! 需要从DropDownList 里面取值在做判断显示DIV的层!
//获取值
protected void btnGet_Click(object sender, EventArgs e)
{
string v1 = DropDownList1.SelectedValue;
litValues.Text = "1.使用 DropDownList1.SelectedValue = " + v1;
litValues.Text += "<br />";
string v2 = DropDownList1.SelectedItem.Value;
string t1 = DropDownList1.SelectedItem.Text;
litValues.Text += "2.使用 DropDownList1.SelectedItem.Value =" + v2 + ";Text = " + t1;
}
ASP.NET DropDownList应用
代码看不出有什么错哦!!
楼主想要什么效果?
{
div1.Style["Display"] = "Block"; //显示
div1.Style["Display"] = "None"; //隐藏}
或onchange
var div=document.getElementById("div1")
div.style.display=div.style.display=="none"?"block":"none";
1、JCK、QTLX加了runat='server'属性
2、DropDownList的autopostback属性设为true
Text才是你要的“次数卡”字符串
if (DropDownList.SelectedValue == "次数卡")
{
JCK.Style.Add(HtmlTextWriterStyle.Display, "block");//显示
QTLX.Style.Add(HtmlTextWriterStyle.Display, "none");//隐藏
}