I’m writing a custom server control inherited from ListControl.
I’m able to change the rendering of the control (overriding the Render method), using a “li” with a custom CSS instead of using the normal tag “option”, but how can i send the selected data back to the control?
I’ve implemented the selection using javascript.
I suppose that i’ve to use javascript to send to the control the selected value, but i don’t know how.
If anyone could bring me in the right way, i’ll appreciate.
Thanks in advance
use some jquery ajax
i mean that’s quick and dirty. And use Request.QueryString collection to pick up the value in the code-behind.
You could instead implement a hidden control in the render method. ASP.NET fan boi’s would have you implementing IPostBackEventHandler.
You could keep it simpler, rendering a plain html hidden and use the Request.Form collection on postback.
And an alt to ajax is some jquery / javascript that either writes the selected valu to a hidden or the form’s querystring before submitting it (which is what that ajax code is doing).