Export (0) Print
Expand All

Panel.BackImageUrl Property

Gets or sets the URL of the background image for the panel control.

[Visual Basic]
Public Overridable Property BackImageUrl As String
[C#]
public virtual string BackImageUrl {get; set;}
[C++]
public: __property virtual String* get_BackImageUrl();
public: __property virtual void set_BackImageUrl(String*);
[JScript]
public function get BackImageUrl() : String;
public function set BackImageUrl(String);

Property Value

The URL of the background image for the panel control. The default is String.Empty.

Remarks

Use this property to display a custom image for the Panel control.

If the image is smaller than the Panel, it will be tiled to fill in the Panel.

Example

[Visual Basic, C#] The following example illustrates how to programmatically set the BackImageUrl property of the Panel.

[Visual Basic] 
<%@ Page Language="VB" AutoEventWireup="True" %>
<html>
 <head>
 
     <script language="VB" runat="server">
 
     Sub Page_Load(sender As Object, e As EventArgs)
        Dim l As New Label()
        l.Text = "This panel contains a right justified label."
        Panel1.Controls.Add(l)
     End Sub     
 
     Sub Button1_Click(sender As Object, e As EventArgs)
        Panel1.BackImageUrl = _
            "//localhost/quickstart/aspplus/images/warning.gif"
     End Sub
 
     </script>
 
 </head>
 <body>
 
     <h3>Panel Example</h3>
 
     <form runat=server>
 
     <asp:Panel id="Panel1" Height=200 Width=200 BackColor="Gainsboro"
     Wrap="True" HorizontalAlign="Right" runat="server"/>
 
         <asp:Button id="Button1" OnClick="Button1_Click"
     Text="Set the label background" runat="server"/>
 
     </form>
 
 </body>
 </html>
 

[C#] 
<%@ Page Language="C#" AutoEventWireup="True" %>
<html>
 <head>
 
     <script language="C#" runat="server">
 
     void Page_Load(Object sender, EventArgs e) {
        Label l = new Label();
        l.Text = "This panel contains a right justified label.";
        Panel1.Controls.Add(l);
     }
     
 
     void Button1_Click(Object sender, EventArgs e) {
        Panel1.BackImageUrl = 
            "//localhost/quickstart/aspplus/images/warning.gif";
     }
 
     </script>
 
 </head>
 <body>
 
     <h3>Panel Example</h3>
 
     <form runat=server>
 
     <asp:Panel id="Panel1" Height=200 Width=200 BackColor="Gainsboro"
     Wrap="True" HorizontalAlign="Right" runat="server"/>
 
         <asp:Button id="Button1" OnClick="Button1_Click"
     Text="Set the label background" runat="server"/>
 
     </form>
 
 </body>
 </html>
 

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# 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

See Also

Panel Class | Panel Members | System.Web.UI.WebControls Namespace

Show:
© 2014 Microsoft