Hello,
I realize this is not the recommended way to do things, but please bear with me. I need to know how to inspect the Request.Form values and parse out the value that has been submitted in a WebDropDown control. I see that Request.Form.Item("myWDD_clientState") has this value:
|0|j&tilda;-1||[[null,[],null],[{"0":[7,0],"1":[41,0],"2":[23,"James%20Harrison"]},[{"1":[0,9,1],"2":[0,7,1],"3":[0,0,81]}]],null]
I can see the text value, which was "James Harrison". But there should be a value of "3" in there that I can parse out using JSON or some other method. There is a "3" as the final parameter of that JSON object, so maybe that's it?
And I recognize that parsing this data is not supported in terms of future compatibility. It is difficult to explain why we need to do this. Basically it is because our in-house developed application development framework is extremely dynamic and mostly follows the pattern of ASP.NET events, but not 100%. When we save a record to the database we process the form submission before rendering the controls onto the page object. So at this point in processing we do not have the page object constructed with controls that have filled themselves with values. So we need to get it from the Response.Form collection.
I look forward to your reply. Thanks!
I'm glad I could help.
Please let me know if you have any other questions.
That was what I needed - thanks!
Hello autharch,
You could handle the SelectionChanged client-side event to set the values of two hidden inputs, which you can access from the Request.Form collection. For example, if you have input elements with IDs "dropdownText" and "dropdownValue", your method should look like this:
If you have any questions, please feel free to contact me.
As a creative workaround, I could render a hidden field for each WebDropDown control. Then if I can hook into a client side event on the WebDropDown that will fire whenever the selection is changed, perhaps I can then copy the selected value into my hidden field. Then I will have the selected value in the form post where I can read it at any point in the page lifecycle. I like this workaround, but I need help with the client side event and JavaScript that would obtain the selected value. Any help?
I have done more research and now I see that the _clientState form post value does not contain the ID of the selected item. For instance, if I select another item with the value being 4, the form post value is:
|0|b&tilda;0||[[null,[],null],[{"0":[7,0],"1":[41,0],"2":[23,"Blake%20%20Smith"]},[{"1":[0,9,1],"2":[0,7,1],"3":[0,0,81]}]],null]
The text value of "Blake Smith" is the text value of the item I selected but the value of 4 is not present.
We really need help on this one. Thank you in advance!