Dynamic Controls
-
I know that when there is a postback, id's for dynamic controls get re-created and they change. i know that we all get null reference exceptions when we try to retrieve them. I only have one problem that i tried looking for a solution on google but havent found it. I have a aspx page with a list of link buttons databound to a collection taken from a database. on the right of that is a user control. In that user control i have all these properties where GUID's are assigned every time some clicks buttons to re generate a new form to display. I get that null reference exception when i try to retrieve the values of the controls before the form is generating a new form. I tried re creating the fomr using the ID's i have now (in properties) but still get the same error that i could not generate my form because my id's were null? I am stuck from here and dont know where to go. Does anyone have a hint of what i can start doing to get myself going?
-
I know that when there is a postback, id's for dynamic controls get re-created and they change. i know that we all get null reference exceptions when we try to retrieve them. I only have one problem that i tried looking for a solution on google but havent found it. I have a aspx page with a list of link buttons databound to a collection taken from a database. on the right of that is a user control. In that user control i have all these properties where GUID's are assigned every time some clicks buttons to re generate a new form to display. I get that null reference exception when i try to retrieve the values of the controls before the form is generating a new form. I tried re creating the fomr using the ID's i have now (in properties) but still get the same error that i could not generate my form because my id's were null? I am stuck from here and dont know where to go. Does anyone have a hint of what i can start doing to get myself going?
You will never be able to reference an object that has not been instantiated. Try using the object after the form has been created.
Excellence is not an act, but a habit!
Aristotle