如何在dropdownlist动态添加item之后,如何设置其value值! /用JS控制服务端dropDownlist和textField的Readonly属性

一共有两种写法:《不使用的数据源的方式》 
1):
       ListItem myListItem = new ListItem("text","value");
       this.DropDownList1.Items.Add(myListItem);
2):
       this.DropDownList1.Items.Add("text1");
       this.DropDownList1.Items.FindByText("text1").Value = "value1";

3):用JS控制服务端dropDownlist和textField的Readonly属性
<asp:DropDownList ID="ddlCardType" runat="server"></asp:DropDownList>
Readonly = disabled
document.getElementById("<%=ddlCardType.ClientID %>").disabled="disabled";
document.getElementById("<%=txtLastFour.ClientID %>").disabled="disabled";

posted @ 2006-06-24 22:53  RicoRui  阅读(2894)  评论(1编辑  收藏  举报