开发者

ComboBox and EnableViewState="false"

开发者 https://www.devze.com 2023-03-27 06:02 出处:网络
Note: I am fairly new with ASP.NET I have a form with two Comb开发者_运维知识库oBoxes and one ASP.NET CheckBox list.

Note: I am fairly new with ASP.NET

I have a form with two Comb开发者_运维知识库oBoxes and one ASP.NET CheckBox list.

I am running into issues outlined as follows:

Though the query was accurate(confirmed by setting breakpoints and hovering over the query and everything step by step) the second ComboBox would not filter by the selected value of the first dropdown. I was then advised to set EnableViewState to false, which I did.

It all worked very nicely, the first ComboBox filtered the second one and the second ComboBox populated the Asp list. The issue now is that the checkboxes selected by the user in the asp list are being deselected after a postback.

When I set EnableViewState to true the checkboxes just refresh, but the second ComboBox does not filter.

Any ideas on what might resolve this issue?

Thank you so much in advance!


Without seeing code, it's hard to guess what's happening. My hunch is that you set EnableViewState to false on the page, but you probably need to set it on specific controls.

So with it turned off for the page, none of the controls will maintain viewstate. So selections and the like will not be maintained across postbacks. If I understand your problem correctly, I think you need no view state on the comboboxes, and then you need viewstate on the checkoxlist.


You need to make sure you are setting the value to something persistent during the post back.


I figured it out. It was because of the type of ComboBox I was using (Obout), though I did not think it was. The OboutComboBox needs to have its controls cleared before it is binded after a post back. (So the load function needed this line of code to work: ComoboBox2.Controls.Clear();) This way one can leave EnableViewState to true.

I hope this helps anyone using the Obout conrol struggling with the same issue.

Cheers

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号