SetPropertyValue Method
Collapse the table of content
Expand the table of content

ProfileGroupBase::SetPropertyValue Method (String^, Object^)

 

Sets the value of a grouped profile property.

Namespace:   System.Web.Profile
Assembly:  System.Web (in System.Web.dll)

public:
void SetPropertyValue(
	String^ propertyName,
	Object^ propertyValue
)

Parameters

propertyName
Type: System::String^

The name of the grouped property to set.

propertyValue
Type: System::Object^

The value to assign to the grouped property.

ASP.NET uses the ProfileBase class to create the class used for the user profile. When an application that has the user profile enabled is started, ASP.NET creates a new class of type ProfileCommon, which inherits from the ProfileBase class. Strongly typed accessors are added to the ProfileCommon class for each group and property defined in the profile Element (ASP.NET Settings Schema) configuration section. The strongly typed accessors of the ProfileCommon class call the SetPropertyValue method to pass grouped property values to the ProfileProvider to be stored at the data source.

You can use the SetPropertyValue method to assign values to grouped properties of the user profile for your application by name. Values are typed as object, and type checking will be done at run time, not compile time. For strongly typed access to profile property values, you can access the grouped property by name as a member of a group of the Profile property, for example, Profile.Address.City.

The following ASP.NET page reads and sets the grouped properties specified for the user profile. For an example of a Web.config file that specifies grouped properties for the user profile, see the example provided for the ProfileGroupBase class.

System_CAPS_security Security Note

This example contains a text box that accepts user input, which is a potential security threat. By default, ASP.NET Web pages validate that user input does not include script or HTML elements. For more information, see Script Exploits Overview.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft