see that example:<%@ Register TagPrefix="iewc" Namespace="Microsoft.Web.UI.WebControls" Assembly="Microsoft.Web.UI.WebControls, Version=1.0.2.226, Culture=neutral, PublicKeyToken=31bf3856ad364e35" %>
<HTML>
<HEAD>
<script language=C# runat=server>
public void myFunc(object sender, System.EventArgs e)
{
ToolbarDropDownList t=(ToolbarDropDownList)Toolbar1.Items[0];
Response.Write(t.SelectedItem.Text);
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="WebForm1" method="post" runat="server">
<iewc:Toolbar id="Toolbar1" runat="server" AutoPostBack="True">
<iewc:ToolbarDropDownList AutoPostBack="True" onSelectedIndexChanged="myFunc">
<asp:ListItem Value="aaa" Selected="True">aaa</asp:ListItem>
<asp:ListItem Value="bbb">bbb</asp:ListItem>
</iewc:ToolbarDropDownList>
</iewc:Toolbar>
</form>
</body>
</HTML>
<HTML>
<HEAD>
<script language=C# runat=server>
public void myFunc(object sender, System.EventArgs e)
{
ToolbarDropDownList t=(ToolbarDropDownList)Toolbar1.Items[0];
Response.Write(t.SelectedItem.Text);
}
</script>
</HEAD>
<body MS_POSITIONING="GridLayout">
<form id="WebForm1" method="post" runat="server">
<iewc:Toolbar id="Toolbar1" runat="server" AutoPostBack="True">
<iewc:ToolbarDropDownList AutoPostBack="True" onSelectedIndexChanged="myFunc">
<asp:ListItem Value="aaa" Selected="True">aaa</asp:ListItem>
<asp:ListItem Value="bbb">bbb</asp:ListItem>
</iewc:ToolbarDropDownList>
</iewc:Toolbar>
</form>
</body>
</HTML>
解决方案 »
- asp.net竟然没有点击按钮打开一个窗口的方法?
- .net变量如何给控件赋值
- 文件正在被另一个人或程序使用!
- CSDN生成帖子功能是怎么做的?
- Linux
- 求助,如何实现单击服务器控件Button后,网页滚动条下拉至浏览器最底端?
- gridview 怎样获取所选记录的关键字?
- 100求一oracle分页存储过程,在线等!
- 开发asp.net的时候选择什么编码?
- 同是一段Page_Load里的代码.要提交Form时,才报System.NullReferenceException错误.
- (SOS求救!)DLL的构造函数中可以带参数吗?如果带了参数,调用时如何传递值给它?
- authority problem with C# programming with word
在InitializeComponent()中加入
Microsoft.Web.UI.WebControls.ToolbarDropDownList DropDownList1=(Microsoft.Web.UI.WebControls.ToolbarDropDownList)Toolbar1.Items[17];
DropDownList1.SelectedIndexChanged += new System.EventHandler(this.DropDownList1_SelectedIndexChanged);然后:
protected void DropDownList1_SelectedIndexChanged(object sender,System.EventArgs e)
{
...........
}散分