下拉列表项上的链接按钮,然后单击 [英] linkbuttons on the dropdown list item and click

查看:72
本文介绍了下拉列表项上的链接按钮,然后单击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要你的帮助..

我正在创建一个页面,页面上有一个下拉列表.
我的要求是.我显示的每个Listitem都应该是一个链接按钮.当我单击链接按钮时,一个事件应该像按钮一样触发.
我已经在每个链接按钮上创建了方法,当我检查该按钮时,该方法应该被触发.



<asp:DropDownList ID="drop1"  runat="server" >
  <asp:ListItem  Text="Excel" Value="1"></asp:ListItem>
 <asp:ListItem  Text="Doc" Value="2"></asp:ListItem>
 <asp:ListItem  Text="CSV" Value="3"></asp:ListItem>
 <asp:ListItem  Text="PDF" Value="4"></asp:ListItem>
 /asp:DropDownList>

解决方案

做到这一点的方法是在客户端处理项目更改事件,然后触发"您的事件.实施IMO的最佳方法是实际重定向到URL,该URL在URL上具有选定的项目作为查询字符串参数,但是您可以使用javascript单击按钮并使其触发回发事件.

当然,存在下拉列表上的事件,当所述选择的变化,在一个事件在这里可以读出的控制的所选择的值,这将导致一个自动回发.

Guys I need your help..

I am creating a page and there is a Drop down list on my page.
My requirement is. every Listitem which I have shown should be a link button. When i click on the link button an event should be fire like a button.
I have have created methods on the every link button, and when i check so that button should be fire.



<asp:DropDownList ID="drop1"  runat="server" >
  <asp:ListItem  Text="Excel" Value="1"></asp:ListItem>
 <asp:ListItem  Text="Doc" Value="2"></asp:ListItem>
 <asp:ListItem  Text="CSV" Value="3"></asp:ListItem>
 <asp:ListItem  Text="PDF" Value="4"></asp:ListItem>
 /asp:DropDownList>

解决方案

The way to do this is to handle the item changed event on the client side, and then ''fire'' your event. The best way to do that IMO is to actually redirect to a URL that has the selected item on the URL as a query string parameter, but you can use javascript to click your button and cause it''s postback event to fire.

Of course, there is an event on that drop list which will cause an auto postback when the selection changes, in to an event where you can read the selected value of the control.


这篇关于下拉列表项上的链接按钮,然后单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆