Showing posts with label properties. Show all posts
Showing posts with label properties. Show all posts

Wednesday, March 28, 2012

How do I use JavaScriptSerializer on only certain properties of an object?

I have an object that inherits from UserControl. I want to seralize certain properties in this object using JavaScriptSerializer (or another method that does the same thing). Unfortunatly, if I try to seralize the control itself, I get a crash.

I am forced to make another object that contains all the properties that need to be seralized. The properites in my control then refrence the properties of that object. Though this works, it leaves my control with a bunch of properties which are effectively nothing more than pointers to another object that exists soley to make javascript seralization to work.

Is there way around this? I want to be able to use JSON on a usercontrol and be able to specify which properties I want seralized to JSON.

Try using the ScriptIgnore attribute in the properties you don't want to be serialized.

Hope this helps,

Elias.


I tried to override every virutal property on usercontrol and I still got "Cannot get inner content of because the contents are not literal."Something in my base class (usercontrol) seems to be causing problems

Monday, March 26, 2012

How Do I Dynamically Add Profile Properties

I am creating a series of panels of data (dynamically) that I want to have the user drag around with theDragOverlayExtender. The problem is that I need to save their position on the page so that the next time they load the page, their panels are right where they left them. I have added theProfileScriptService and for eachDragOverlayExtender that I am creating, I am setting theProfileProperty to a unique value. The problem is that there can be any number of panels, so I cannot present values in the config file.

How can I dynamically add profile properties?

Also, (as a side question) how can I read and set the relative positions of the panels that have been moved via theDragOverlayExtender?

Thanks!

- David E. Craig

I'm not sure about the addition of dynamic profile properties, but since the ProfileScriptService is a core Atlas control, you might considerposting the question in one of the dedicated Atlas forums. Regarding the panel position, it's looking to me like the Location/location property of the DragPanelExtender/Behavior should do what you need?

Sorry, but has the dragoverlayextender an Location property?

Thanks,

Rodrigo Sendin


It did before ASP.NET AJAX Beta 1 when I made the recommendation. :) It's been removed, but may be back soon as time/underlying framework permits.