如何在不回发的情况下触发dropdownlist的SelectedIndexChanged? [英] How to fire dropdownlist's SelectedIndexChanged without postback?

查看:55
本文介绍了如何在不回发的情况下触发dropdownlist的SelectedIndexChanged?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的数据绑定到数据库中的查询页面上有一个DropDownList(数据绑定仅在.aspx文件中设置,而在后台代码中未设置)。在它旁边,我有第二个DDL,该DDL从第一个的SelectedIndexChanged函数填充。这有效,但仅当AutoPostback设置为true时。

I've got a DropDownList on my page databound to a query from my database (Databinding is set up only in my .aspx file, not in codebehind). Next to it I have a second DDL that gets populated from the SelectedIndexChanged function of the first one. This works, but only when AutoPostback is set to true.

是否有一种方法可以触发SelectedIndexChanged事件或在我的代码背后手动调用此函数,而不必每次都重新加载页面?

Is there a way to fire the SelectedIndexChanged event or manually call this function in my codebehind without having to reload the page every time?

推荐答案

我会将DDL放在AJAX UpdatePanel 内,因此它只会更新页面的那部分而不是整页重新加载。

I would put the DDLs inside an AJAX UpdatePanel so it only updates that part of the page instead of a full page reload.

这篇关于如何在不回发的情况下触发dropdownlist的SelectedIndexChanged?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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