Sharepoint Forum

 
Home » Forum » Sharepoint       Ask a questionRSS Feeds

Custom Properties

  Asked By: Simon Maldonado         Date: Aug 19, 2004      Category: Sharepoint      Views: 213
 

Setting custom properties to user provided values using the Custom
Property Tool Part in the Tool Pane works like a charm. However, when I
try setting those same property values in code, the values are not
saved. How can I force the Web Part to serialize my updates to the
database?

Tagged:    

 

3 Answers Found

 
Answer #1       Answered By: Javier Hawkins          Answered On: Aug 19, 2004       

I haven't really tested it, but I've seen the following code  using
"SaveProperties = true"

Here's an example:

// Event handler for _mybutton control that sets the
// Title property  to the value in _mytextbox control.
public void _mybutton_click (object sender, EventArgs e)
{
this.Title = _mytextbox.Value;
try
{
this.SaveProperties=true;
}
catch
{
Caption = "Error... Could not save property.";
}
}

 
Answer #2       Answered By: Tracy Bass          Answered On: Aug 19, 2004       

I'll give this a shot and provide feedback to the group.

 
Answer #3       Answered By: Dominick Blake          Answered On: Aug 19, 2004       

I have tested this quite extensively, and it does work, within limits. I suspect that it only works  for XML sieralizable properties. I tested it with integers, strings, and a custom  class. The string and integer worked perfectly (so I can now fix my Yachted web  part!) but the custom class did not. I’m currently looking into how to make a custom class be sieralizable so it too can be saved as a property.

 
Didn't find what you were looking for? Find more on Custom Properties Or get search suggestion and latest updates.


Your Answer
  • Answer should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].