更新下拉列表 [英] Update a Dropdownlist

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

问题描述

我的asp.net页面上有两个下拉列表,第二个需要根据第一个下拉列表中的选择填写。当我设置Autopostback =true时它工作正常。然而,这个问题是,它必须在没有回发/页面加载的情况下发生。



有没有人有办法实现这一目标?我通过谷歌搜索找到了很多解决方案,但我不明白。我不是很擅长asp.net。如果你有,请给我简单的代码。



在此先感谢您,非常感谢您的帮助。



Sazzad

解决方案

在页面中添加ajax更新面板并在其中放入下拉列表控件..



使用此链接作为参考。



http://www.c-sharpcorner.com/Forums/Thread/199983/cascading-dropdownlist-using-updatepanel.aspx [ ^ ]


您可以使用更新面板来实现此目的或使用 JQuery 。当更新面板仅回发更新面板内部的内容并避免完整的回发(以及页面加载)时,Jquery将通过对服务器进行javascript调用来完全避免回发操作。



但是如果您的目标是避免页面加载事件中的某些操作,我建议您使用 IsPostback属性将被设置为true。

I have two drop down lists on my asp.net page, the second of which needs to be filled in based on the selection in the first dropdownlist. It's work fine when I set Autopostback="true". The catch
however, is that it must occur without a postback/pageload.

Does anyone have a way to accomplish this? I have found many solution by googling, but I don't understand them. I am not very good at asp.net. Please give me the simple code if you have.

Thanks in advance, your help is greatly appreciated.

Sazzad

解决方案

Add ajax update panel in your page and put drop down list controls in it..

use this link as reference.

http://www.c-sharpcorner.com/Forums/Thread/199983/cascading-dropdownlist-using-updatepanel.aspx[^]


You may use Update Panels to acheive this or use JQuery. Jquery will completely avoid postback action by making a javascript call to the server when update panel will postback only what is inside of the update panel and will avoid a complete postback (and also the pageload).

However if your goal is to avoid some actions in your pageload event I would suggest you to use IsPostback property wich will be set to true when the server call comes from a postback.


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

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