具有autopostback的下拉列表=" true"显示第一项选择任何项目 [英] Dropdownlist with autopostback="true" showing 1st item on selecting any item

查看:65
本文介绍了具有autopostback的下拉列表=" true"显示第一项选择任何项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个下拉列表: - ddl1和ddl2。 ddl2填充在ddl1的selectedindexchange事件上,即在运行时。 ddl1和ddl2都有Autopostback =true。 ddl2也处理了selectedindexchange事件。但是当我尝试在ddl2中选择一个项目时,它会刷新页面并显示ddl2中的第一个项目。我在互联网上搜索了它并尝试了各种各样的事情,例如在更新面板中放置ddl2,以及处理pagelifecycle的prerender事件,但它们没有帮助。请提供一些解决方案。这是我的项目所必需的。请帮助



我尝试过:



<$ p $我已经在互联网上搜索了它并尝试了各种各样的事情,例如在更新面板中放置ddl2,以及处理页面生命周期的预渲染事件,但它们没有帮助。我也尝试过设置enableviewstate =True和ViewStateMode =Enabled而没有任何运气。

解决方案

我怀疑你没有检查过页面加载中的IsPostBack属性。检查一下。


I have two dropdownlists:- "ddl1" and "ddl2". "ddl2" is populated on selectedindexchange event of "ddl1" i.e. at runtime. "ddl1" and "ddl2" both have Autopostback="true". "ddl2" also has selectedindexchange event handled. But when I try to select an item in "ddl2" it refreshes the page and it shows the 1st item in the "ddl2". I have searched it on the internet and tried various things like putting "ddl2" in update panel, and handling prerender event of pagelifecycle, but they didn't help. Please provide some solution. It is required for my project. Please help

What I have tried:

I have searched it on the internet and tried various things like putting "ddl2" in update panel, and handling prerender event of pagelifecycle, but they didn't help. I have also tried setting enableviewstate="True" and ViewStateMode="Enabled" without any luck.

解决方案

I suspect you have not checked the IsPostBack property in Page Load. Check that out.


这篇关于具有autopostback的下拉列表=&quot; true&quot;显示第一项选择任何项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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