UrlBuilder Class

UrlBuilder Class

Starts a URL editor that allows a user to select a URL.

For a list of all members of this type, see UrlBuilder Members.

System.Object
   System.Web.UI.Design.UrlBuilder

[Visual Basic]
NotInheritable Public Class UrlBuilder
[C#]
public sealed class UrlBuilder
[C++]
public __gc __sealed class UrlBuilder
[JScript]
public class UrlBuilder

Thread Safety

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Remarks

The BuildUrl method starts a user interface for selecting a URL.

Example

[Visual Basic] 
' Create a parent control.
Dim c As New System.Windows.Forms.Control()
c.CreateControl()

' Launch the Url Builder using the specified control
' parent, initial URL, empty relative base URL path,
' window caption, filter string and URLBuilderOptions value.
System.Web.UI.Design.UrlBuilder.BuildUrl(Me.Component, c, "http://www.example.com", "Select a URL", "", UrlBuilderOptions.None)

[C#] 
// Create a parent control.
System.Windows.Forms.Control c = new System.Windows.Forms.Control();            
c.CreateControl();            
            
// Launch the Url Builder using the specified control
// parent, initial URL, empty relative base URL path,
// window caption, filter string and URLBuilderOptions value.
System.Web.UI.Design.UrlBuilder.BuildUrl(this.Component, c, "http://www.example.com", 
                                            "Select a URL", "", UrlBuilderOptions.None);                      

[C++] 
// Create a parent control.
System::Windows::Forms::Control* c = new System::Windows::Forms::Control();
c->CreateControl();

// Launch the Url Builder using the specified control
// parent, initial URL, empty relative base URL path,
// window caption, filter String* and URLBuilderOptions value.
UrlBuilder::BuildUrl(this->Component, c, S"http://www.example.com",
   S"Select a URL", S"", UrlBuilderOptions::None);

[Visual Basic] 
' Example designer provides a designer verb menu command to launch the 
' BuildUrl method of the UrlBuilder.
Public Class UrlBuilderDesigner
    Inherits System.Web.UI.Design.UserControlDesigner

    Public Sub New()
    End Sub

    ' Provides a designer verb menu command for invoking the BuildUrl 
    ' method of the UrlBuilder.
    Public Overrides ReadOnly Property Verbs() As System.ComponentModel.Design.DesignerVerbCollection
        Get
            Dim dvc As New DesignerVerbCollection()
            dvc.Add(New DesignerVerb("Launch URL Builder UI", New EventHandler(AddressOf Me.launchUrlBuilder)))
            Return dvc
        End Get
    End Property

    ' This method handles the "Launch Url Builder UI" menu command.
    ' Invokes the BuildUrl method of the System.Web.UI.Design.UrlBuilder.
    Private Sub launchUrlBuilder(ByVal sender As Object, ByVal e As EventArgs)
        ' Create a parent control.
        Dim c As New System.Windows.Forms.Control()
        c.CreateControl()

        ' Launch the Url Builder using the specified control
        ' parent, initial URL, empty relative base URL path,
        ' window caption, filter string and URLBuilderOptions value.
        System.Web.UI.Design.UrlBuilder.BuildUrl(Me.Component, c, "http://www.example.com", "Select a URL", "", UrlBuilderOptions.None)
    End Sub

End Class

' Example Web control displays the value of its text property.
' This control is associated with the UrlBuilderDesigner.
<DesignerAttribute(GetType(UrlBuilderDesigner), GetType(IDesigner))> _
Public Class UrlBuilderControl
    Inherits System.Web.UI.WebControls.WebControl
    Private [text_] As String

    <Bindable(True), Category("Appearance"), DefaultValue("")> _
    Public Property [Text]() As String
        Get
            Return [text_]
        End Get

        Set(ByVal Value As String)
            [text_] = Value
        End Set
    End Property

    Protected Overrides Sub Render(ByVal output As HtmlTextWriter)
        output.Write([Text])
    End Sub

End Class

[C#] 
// Example designer provides a designer verb menu command to launch the 
// BuildUrl method of the UrlBuilder.
public class UrlBuilderDesigner : System.Web.UI.Design.UserControlDesigner
{
    public UrlBuilderDesigner()
    {
    }

    // Provides a designer verb menu command for invoking the BuildUrl 
    // method of the UrlBuilder.
    public override System.ComponentModel.Design.DesignerVerbCollection Verbs
    {
        get
        {
            DesignerVerbCollection dvc = new DesignerVerbCollection();                
            dvc.Add( new DesignerVerb("Launch URL Builder UI", new EventHandler(this.launchUrlBuilder)) );
            return dvc;
        }
    }
            
    
    // This method handles the "Launch Url Builder UI" menu command.
    // Invokes the BuildUrl method of the System.Web.UI.Design.UrlBuilder.
    private void launchUrlBuilder(object sender, EventArgs e)
    {
        // Create a parent control.
        System.Windows.Forms.Control c = new System.Windows.Forms.Control();            
        c.CreateControl();            
                    
        // Launch the Url Builder using the specified control
        // parent, initial URL, empty relative base URL path,
        // window caption, filter string and URLBuilderOptions value.
        System.Web.UI.Design.UrlBuilder.BuildUrl(this.Component, c, "http://www.example.com", 
                                                    "Select a URL", "", UrlBuilderOptions.None);                      
    }        
}

// Example Web control displays the value of its text property.
// This control is associated with the UrlBuilderDesigner.
[DesignerAttribute(typeof(UrlBuilderDesigner), typeof(IDesigner))]
public class UrlBuilderControl : System.Web.UI.WebControls.WebControl
{
    private string text;

    [Bindable(true),
    Category("Appearance"),
    DefaultValue("")]
    public string Text
    {
        get
        {
            return text;
        }

        set
        {
            text = value;
        }
    }

    protected override void Render(HtmlTextWriter output)
    {
        output.Write(Text);
    }
}

[C++] 
// Example designer provides a designer verb menu command to launch the
// BuildUrl method of the UrlBuilder.
public __gc class UrlBuilderDesigner : public UserControlDesigner {
public:
   UrlBuilderDesigner() {
   }

   // Provides a designer verb menu command for invoking the BuildUrl
   // method of the UrlBuilder.
public:
   __property DesignerVerbCollection* get_Verbs() {
      DesignerVerbCollection* dvc = new DesignerVerbCollection();
      dvc->Add(new DesignerVerb(S"Launch URL Builder UI", new EventHandler(this, &UrlBuilderDesigner::launchUrlBuilder)));
      return dvc;
   }

   // This method handles the "Launch Url Builder UI" menu command.
   // Invokes the BuildUrl method of the System::Web::UI::Design.UrlBuilder.
private:
   void launchUrlBuilder(Object* /*sender*/, EventArgs* /*e*/) {
      // Create a parent control.
      System::Windows::Forms::Control* c = new System::Windows::Forms::Control();
      c->CreateControl();

      // Launch the Url Builder using the specified control
      // parent, initial URL, empty relative base URL path,
      // window caption, filter String* and URLBuilderOptions value.
      UrlBuilder::BuildUrl(this->Component, c, S"http://www.example.com",
         S"Select a URL", S"", UrlBuilderOptions::None);
   }
};

// Example Web control displays the value of its text property.
// This control is associated with the UrlBuilderDesigner.
[DesignerAttribute(__typeof(UrlBuilderDesigner), __typeof(IDesigner))]
public __gc class UrlBuilderControl : public WebControl {
private:
   String* text;

public:
   [Bindable(true),
      Category(S"Appearance"),
      DefaultValue(S"")]
   __property String* get_Text() {
      return text;
   }
   __property void set_Text(String* value) {
      text = value;
   }


protected:
   void Render(HtmlTextWriter* output) {
      output->Write(Text);
   }
};

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

Requirements

Namespace: System.Web.UI.Design

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

Assembly: System.Design (in System.Design.dll)

See Also

UrlBuilder Members | System.Web.UI.Design Namespace | UrlBuilderOptions

Show:
© 2016 Microsoft