Asp.net下拉活动 [英] Asp.net dropdown events

查看:71
本文介绍了Asp.net下拉活动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在检查下拉列表文本

n只有当文本为OTHER时才需要真正的索引更改事件



有可能???

I m checking drop down list text
n want true index change event only if text is "OTHER"

Is it possible???

推荐答案

我的答案丢失了......



如果你在客户端处理change事件,如果文本是'OTHER'则返回true,那么服务器端事件只会在那种情况下触发。
My answer was lost...

If you handle the change event on the client side and return true if the text is 'OTHER', then a server side event will only fire in that case.


不,它不是。如果您选择不同的商品 DropDownList ,将触发 SelectedIndexChanged 事件。在您的情况下,您可以阻止操作而不是事件。试试这个:

No, it's not. SelectedIndexChanged event will be fired if you'll select different item DropDownList. In your case, you can prevent the action not the event. Try this:
protected void ddlTest_SelectedIndexChanged(object sender, EventArgs e)
{
    if(ddlTest.SelectedItem.Text == "Other")
    {
         //Write your code here.
    }
}







- Amit


这篇关于Asp.net下拉活动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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