Results 1 to 4 of 4

Thread: [RESOLVED] Creating simple asp.net control

Threaded View

  1. #1

    Thread Starter
    Addicted Member silentthread's Avatar
    Join Date
    Jun 2006
    Location
    Miami, Florida
    Posts
    143

    Resolved [RESOLVED] Creating simple asp.net control

    Hi,

    This is my first time with asp.net control, and I guess all I need is a little push, because I'm probably overlooking something pretty simple.

    I'm trying to create an asp.net button control that when you click on it, it closes the webpage without having to deal with the dialog box...
    "This windows is trying to close, etc"

    The code below works, but you have to deal with the dialog box.

    code Code:
    1. output.Write("<input type='button' value='close' onclick='javascript: window.close();'></input>")



    Here is the code with the javascript part that does not work.
    It only wants to execute the first line of the javascript....
    window.opener='x'

    code Code:
    1. Imports System.ComponentModel
    2. Imports System.Web.UI
    3.  
    4. <DefaultProperty("Text"), ToolboxData("<{0}:closebutton runat=server></{0}:closebutton>")> Public Class closebutton
    5.     Inherits System.Web.UI.WebControls.WebControl
    6.  
    7.     Dim _text As String
    8.  
    9.     <Bindable(True), Category("Appearance"), DefaultValue("")> Property [Text]() As String
    10.         Get
    11.             Return _text
    12.         End Get
    13.  
    14.         Set(ByVal Value As String)
    15.             _text = Value
    16.         End Set
    17.     End Property
    18.  
    19.  
    20.  
    21.     Protected Overrides Sub Render(ByVal output As System.Web.UI.HtmlTextWriter)
    22.         output.Write("<input type='button' value='close' onclick='javascript: window.opener='x';window.close();'></input>")
    23.     End Sub
    Last edited by silentthread; Jan 4th, 2008 at 03:10 PM.
    Watch media as you download it! Excellent tool!
    FREE CUBA!
    MyBlog
    If you feel my post has helped, please rate it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width