This documentation is archived and is not being maintained.

PanelDesigner.MapPropertyToStyle Method

Maps a specified property and value to an intrinsic HTML style.

[Visual Basic]
Overrides Protected Sub MapPropertyToStyle( _
   ByVal propName As String, _
   ByVal varPropValue As Object _
)
[C#]
protected override void MapPropertyToStyle(
 string propName,
 object varPropValue
);
[C++]
protected: void MapPropertyToStyle(
 String* propName,
 Object* varPropValue
);
[JScript]
protected override function MapPropertyToStyle(
   propName : String,
 varPropValue : Object
);

Parameters

propName
The property to convert to an HTML style attribute.
varPropValue
The value of the property to convert.

Example

[Visual Basic] The following code example overrides the MapPropertyToStyle method to convert the Panel.Wrap property and its value to the NoWrap HTML attribute and the appropriate value for that attribute.

[Visual Basic] 
' Override the MapPropertyToStyle method to set the
' Panel.Wrap property to the NoWrap HTML attribute.
Overrides Protected Sub MapPropertyToStyle(propName As String, varPropValue As Object) 
   ' Display messages when debugging.
   Debug.Assert(Not (propName = Nothing Or propName.Length <> 0), "Invalid property name passed in.")
   Debug.Assert(Not (varPropValue = Nothing), "Invalid property value passed in.")

   ' If the parameters passed to the method are null,
   ' return nothing. 
   If ((propName Is Nothing) And (varPropValue Is Nothing)) Then
      Return
   End If
   
   ' If the second parameter is not a null
   ' value, check whether the property name is Wrap.
   If Not (varPropValue Is Nothing) Then
      Try
         ' If property name is wrap, convert
         ' it to the HTML NoWrap attribute.
         If (propName.Equals("Wrap")) Then
            Dim strValue As String = String.Empty
            
            If (CType(varPropValue, Boolean)) Then
               Behavior.SetStyleAttribute("NoWrap", True, strValue, True)
            End If
         Else
           MyBase.MapPropertyToStyle(propName, varPropValue)             
         End If  
       Catch ex As Exception
         Debug.Fail(ex.ToString())
       End Try            
    End If
 End Sub 'MapPropertyToStyle

[C#, C++, JScript] No example is available for C#, C++, or JScript. To view a Visual Basic example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Platforms: Windows 2000, Windows XP Professional, Windows Server 2003 family

.NET Framework Security: 

See Also

PanelDesigner Class | PanelDesigner Members | System.Web.UI.Design.WebControls Namespace

Show: