views:

66

answers:

2

Hello Everyone,

This is weird, but I've been using this method all over my code: I have dropdown lists that I populate client-side, using callbacks and because of this I'm unable to access their selected values from code behind and using a hidden field to store selected value in it. I had no problem retrieving the hidden field's value on postback, but all of a sudden it stopped working and is always blank, even when the value on client side is present. Any thoughts?

P.S. I'm not setting or resetting hidden fields on postback.

+1  A: 

Okay, if someone wonders what's wrong: it seems there's something related to jQuery. The thing is that DropDownLists and the hidden field, along with the button that causes postback are inside a jQuery UI dialog that is initiated on page load without opening and appended to the form. Besides this dialog i'm initializin another one and also appending to the form, but for some reason the first appended dialog exibits the weird behavior when postback works, but hidden field does not retain the value. If i don't append the second dialog to the form, everything works as expected. Can't really tell what might appending the second dialog be doing that is causing this weird behavior.

P.S if i reverse the order in which those two dialog boxes are appended, it works just fine... Weird!

Dimitri
Had the same problem. As I moved all hidden fields out of the dialog it started working.
dmitko
A: 

Using .NET?

When the values are added dynamically the backend has no clue. You need to use Request.Form to get the values posted back just like oldschool ASP days.

epascarello