如何识别下拉列表是否在asp.net中回发? [英] How to identify dropdownlist is postback or not in asp.net ?

查看:67
本文介绍了如何识别下拉列表是否在asp.net中回发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三个下拉菜单国家/地区,州,城市有autopostback = true和一个显示按钮。

当我选择国家/地区下拉菜单时,页面也会每次加载

i想要选择下拉列表时要限制页面挂载。



如何在asp.net中实现



请给我你的宝贵建议

I have three dropdowns Country,state,city with autopostback=true and one show button .
when I am selecting country dropdown, page is also loading everytime
i want to ristrict pageloade while selecting the dropdownlilsts.

How it is possible in asp.net

Please give me Your valueble suggetions

推荐答案

嗨Srinivasa,



因为你使用的是autopostback,所以页面应该是加载。



我明白,您想要在国家/地区选择中加载州,然后在状态选择中加载您要列出的城市。



这样做。



保持autopost在国家和州的状态恢复正常,并在城市上关闭自动回复功能。



1)将所有三个控件放在一行中,所有三个控件都放在AJAX UpdatePanel中。您将需要scriptmanager来运行ajax。对于任意数量的AJAX,1个scriptmanager应该可以工作。

2)在国家选择上,在回发事件中,列出状态。跟踪国家/地区下拉列表是否已清除。

3)然后在州选择中,保留国家/地区价值,州值并填充城市。



现在,你还没有告诉我们应该做什么节目按钮,但我想在显示按钮点击,你想加载一些细节或其他页面或其他什么。



所以我猜你现在可以使用上面选择的下拉值了。



保持编码。

谢谢。
Hi Srinivasa,

Since you are using autopostback, page is supposed to load.

I understand, you want to load the state on country selection and then on state selection you want to list the cities.

Do it like this.

Keep autopost back true on country and state and turn auto postback off on city.

1) Put all three control in a single row and all three should be in an AJAX UpdatePanel. You will require scriptmanager to run ajax. For any number of AJAXs, 1 scriptmanager should work.
2) On country selection, on postback event, list the states. Keep track that country dropdown is not cleared.
3) Then on State selection, retain country value, state value and populate cities.

Now, you have not told what show button is supposed to do, but i guess on show button click, you want to load some details or another page or whatever.

So I guess you can use above selected dropdown values now.

Keep coding.
Thanks.


这篇关于如何识别下拉列表是否在asp.net中回发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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