I have a custom made ASP control which is based on a select (drop down menu). If I disable my control by adding the word ‘disabled’ in its html, I start getting null pointer errors when processing the form data.
I figure, either the browser doesn’t post back disabled form items or ASP.NET ignores them when processing the form data. I’m not sure which one it is. I’m trying to understand where I’m loosing data.
Thanks for your help.
PS. I realize that there are better way to create and disable controls than manually editing html but there’s a context here that doesn’t allow me to do otherwise.
Yes setting control’s Enable = false is prevents control’s value to be added posted data collection.
you can use readonly attribute instead.
here in MSDN it says :
Also here is the Microsoft’s reply to a bug report related to topic.
but if you use in classical way like that it will work :