Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi,

I have compositecontrol, this is a container, inside this compositecontrol i have a ascx control the problem is that custom properties of this ascx control are not preserved after postback.

The ascx controls are dragged and dropped in design mode

I hope you can help me with this problem.

Regards.
Posted
Comments
Sergey Alexandrovich Kryukov 29-Apr-14 11:19am    
Isn't the answer hidden in your question?
—SA
Angel Blandón 29-Apr-14 11:31am    
If the answer is hidden in my question i can't see it, if you can see it please tell me.
Sergey Alexandrovich Kryukov 29-Apr-14 11:42am    
It's not really clear what is your problem. From your question, it looks like you already understand the matter and how to solve the problem.

Please see Solution 1. First links shows the example of working with ViewState for keeping control states...
Will it be helpful for you? If it will, please don't forget to accept the answer formally (green "Accept" button)...

—SA

1 solution

Please see: http://msdn.microsoft.com/en-us/library/vstudio/1whwt1k7%28v=vs.100%29.aspx[^].

For the background, please start here:
http://msdn.microsoft.com/en-us/library/bb386448.aspx[^].

This CodeProject article could also be useful: Beginner's Guide To View State [^].

—SA
 
Share this answer
 
Comments
Angel Blandón 29-Apr-14 17:18pm    
Thanks for your reply, i have test the example in first url, Custom properties are preserved on postback, but in this case my ascx have other controls like panels, textbox, buttons if i set panel.visible = false; this is not preserved on postback, as i said before this ascx is inside a custom compositecontrol.
Sergey Alexandrovich Kryukov 29-Apr-14 17:54pm    
What's the difference? You should expose the "inside" property to the composite control (actually, create a new property and implement its accessors using the inside property), and then use this new property in exact same way as any other one.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900