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:
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:
Imports System.ComponentModel Imports System.Web.UI <DefaultProperty("Text"), ToolboxData("<{0}:closebutton runat=server></{0}:closebutton>")> Public Class closebutton Inherits System.Web.UI.WebControls.WebControl Dim _text As String <Bindable(True), Category("Appearance"), DefaultValue("")> 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 System.Web.UI.HtmlTextWriter) output.Write("<input type='button' value='close' onclick='javascript: window.opener='x';window.close();'></input>") End Sub





Reply With Quote