0

Note: I am fairly new with ASP.NET

I have a form with two ComboBoxes 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!

sll
  • 61,540
  • 22
  • 104
  • 156
anpatel
  • 1,952
  • 4
  • 19
  • 36
  • 1
    Post some code so we can look at what your doing... – Zachary Aug 11 '11 at 20:35
  • You said you are using a ComboBox, are you actually using a plugin to create a ComboBox from the "AspTxtBox" in your code above. If so, we'll need more details about this plugin and need your code showing how you are triggering the filtering on the second ComboBox. – Zachary Aug 11 '11 at 20:56
  • Alright I will try and get everything I pasted most of it already have another glimpse – anpatel Aug 11 '11 at 21:03
  • The naming convention is a bit different from what I posted before, but the code is exactly the same. – anpatel Aug 11 '11 at 21:18
  • The Asp List is not a combobox, it is a checkbox list – anpatel Aug 11 '11 at 21:30

3 Answers3

1

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.

Sean
  • 564
  • 1
  • 3
  • 12
  • Ahhh Ok I will try setting EnableViewState to true for the checkboxlist – anpatel Aug 11 '11 at 20:53
  • Didn't work. I don't want to post the code because there is alot of it and when I do post it not all of it gets posted. :S – anpatel Aug 11 '11 at 20:57
0

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

Doug Chamberlain
  • 11,192
  • 9
  • 51
  • 91
0

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

sll
  • 61,540
  • 22
  • 104
  • 156
anpatel
  • 1,952
  • 4
  • 19
  • 36