Hello everyone
I just use a MsgBox component for ASP.NET using Methods such as Render and
OnPreRender and JavaScript involved to get a simple Confirmation Box in
client side, but the funny thing is when I go SmartNavigation property equal
True the MessageBox does not come up!
But if you open another window and return to the browser you can see the
pop-up window !!!
Any Suggestions?
This is the complete code to Confirmation Pop-up:
Imports System.Componen tModel
Imports System.Web.UI
Imports System.Web.UI.W ebControls
Public Class MsgBox
Inherits System.Web.UI.W ebControls.WebC ontrol
Implements IPostBackEventH andler
Private _Message As String
Private _Key As String
Private _PostBackOnYes As Boolean
Private _PostBackOnNo As Boolean
Public Event YesChoosed(ByVa l sender As Object, ByVal Key As String)
Public Event NoChoosed(ByVal sender As Object, ByVal Key As String)
Public Sub ShowConfirmatio n(ByVal Message As String, ByVal Key As
String, ByVal PostBackOnYes As Boolean, ByVal PostBackOnNo As Boolean)
_Message = "ÑaÑa" & Message
_Key = Key
_PostBackOnYes = PostBackOnYes
_PostBackOnNo = PostBackOnNo
End Sub
Public Sub ShowMessage(ByV al Message As String)
_Message = Message
End Sub
Protected Overrides Sub OnPreRender(ByV al e As EventArgs)
If Not MyBase.Page.IsC lientScriptBloc kRegistered("Ms gBox") Then
Page.RegisterCl ientScriptBlock ("MsgBox", FuncionJava1())
End Sub
Private Function FuncionJava1() As String
Dim miPostBackOnYes As String = "MsgBoxTextoMen saje="""";"
Dim miPostBackOnNo As String = "MsgBoxTextoMen saje="""";"
If _PostBackOnYes Then
miPostBackOnYes = Page.GetPostBac kEventReference (Me, "Yes" & _Key)
End If
If _PostBackOnNo Then
miPostBackOnNo = Page.GetPostBac kEventReference (Me, "No_" & _Key)
End If
Return "<script language=""java script""> " & _
"var MsgBoxTipoMensa je; " & _
"var MsgBoxTextoMens aje; " & _
"window.attachE vent(""onfocus" ", MsgBoxMostrarMe nsaje); " & _
"function MsgBoxMostrarMe nsaje() { " & _
"if (MsgBoxTextoMen saje) { " & _
"if (MsgBoxTextoMen saje != """") { " & _
"if (MsgBoxTipoMens aje==2) {" & _
" alert(MsgBoxTex toMensaje); " & _
"} else {" & _
"if (confirm(MsgBox TextoMensaje)) { " & _
miPostBackOnYes & _
"} else { " & _
miPostBackOnNo & _
"}} MsgBoxTextoMens aje=""""; " & _
" }}} </script>"
End Function
<Security.Permi ssions.Permissi onSetAttribute( Security.Permis sions.SecurityA ction.Demand, Name:="FullTrus t")> _
Protected Overrides Sub Render(ByVal writer As
System.Web.UI.H tmlTextWriter)
If ModoDisenio(Me) Then
writer.Write(Me .ID)
Else
If _Message <> String.Empty Then
Dim miSB As System.Text.Str ingBuilder = New
System.Text.Str ingBuilder(_Mes sage)
miSB.Replace(Mi crosoft.VisualB asic.vbCr, " "c)
miSB.Replace(Mi crosoft.VisualB asic.vbLf, " "c)
miSB.Replace("" "", "'"c)
If miSB.ToString.S tartsWith("Ñaà ‘a") Then
Me.Page.Respons e.Write("<scrip t>MsgBoxTipoMen saje=1;
MsgBoxTextoMens aje=""" + _
miSB.ToString.S ubstring(4) + """;</script>")
Else
Me.Page.Respons e.Write("<scrip t>MsgBoxTipoMen saje=2;
MsgBoxTextoMens aje=""" + _
miSB.ToString + """;</script>")
End If
miSB = Nothing
End If
End If
End Sub
Private Shared Function ModoDisenio(ByV al QueControl As _
System.Web.UI.W ebControls.WebC ontrol) As Boolean
Dim DesignMode As Boolean = False
Try
DesignMode = QueControl.Site .DesignMode
Catch : End Try
Return DesignMode
End Function
Public Sub RaisePostBackEv ent(ByVal eventArgument As String) _
Implements IPostBackEventH andler.RaisePos tBackEvent
Select Case eventArgument.S ubstring(0, 3)
Case "Yes"
RaiseEvent YesChoosed(Me, eventArgument.S ubstring(3))
Case "No_"
RaiseEvent NoChoosed(Me, eventArgument.S ubstring(3))
End Select
End Sub
End Class
*************** *************** *************** ***
You can save this code and generate a Component, after that I am using this
code:
MsgBox1.ShowCon firmation("Do you want to delete this record?", "BORRAR",
True, False)
AND if you click and SmartNavigation equal True the Windows will not comes up!
I realized that and some computers does not appear the window even if the
NavigationSmart is False !!!
Any Suggestions????
--
Regards,
Martz 1 2751
Hi Martz:
SmartNav causes all sorts of difficulties when JavaScript and DHTML
are involved on the page. The only good workaround is to get rid of
SmartNav.
If you need to persist scroll position, there are some techniques to
do that for 1.1 on the web.
--
Scott http://www.OdeToCode.com/blogs/scott/
On Thu, 28 Jul 2005 07:58:04 -0700, "Martz"
<Ma***@discussi ons.microsoft.c om> wrote: Hello everyone
I just use a MsgBox component for ASP.NET using Methods such as Render and OnPreRender and JavaScript involved to get a simple Confirmation Box in client side, but the funny thing is when I go SmartNavigation property equal True the MessageBox does not come up!
But if you open another window and return to the browser you can see the pop-up window !!!
Any Suggestions?
This is the complete code to Confirmation Pop-up:
Imports System.Componen tModel Imports System.Web.UI Imports System.Web.UI.W ebControls
Public Class MsgBox Inherits System.Web.UI.W ebControls.WebC ontrol Implements IPostBackEventH andler
Private _Message As String Private _Key As String Private _PostBackOnYes As Boolean Private _PostBackOnNo As Boolean
Public Event YesChoosed(ByVa l sender As Object, ByVal Key As String) Public Event NoChoosed(ByVal sender As Object, ByVal Key As String)
Public Sub ShowConfirmatio n(ByVal Message As String, ByVal Key As String, ByVal PostBackOnYes As Boolean, ByVal PostBackOnNo As Boolean) _Message = "ÑaÑa" & Message _Key = Key _PostBackOnYes = PostBackOnYes _PostBackOnNo = PostBackOnNo End Sub
Public Sub ShowMessage(ByV al Message As String) _Message = Message End Sub
Protected Overrides Sub OnPreRender(ByV al e As EventArgs) If Not MyBase.Page.IsC lientScriptBloc kRegistered("Ms gBox") Then Page.RegisterC lientScriptBloc k("MsgBox", FuncionJava1()) End Sub
Private Function FuncionJava1() As String Dim miPostBackOnYes As String = "MsgBoxTextoMen saje="""";" Dim miPostBackOnNo As String = "MsgBoxTextoMen saje="""";"
If _PostBackOnYes Then miPostBackOnYes = Page.GetPostBac kEventReference (Me, "Yes" & _Key) End If If _PostBackOnNo Then miPostBackOnNo = Page.GetPostBac kEventReference (Me, "No_" & _Key) End If
Return "<script language=""java script""> " & _ "var MsgBoxTipoMensa je; " & _ "var MsgBoxTextoMens aje; " & _ "window.attachE vent(""onfocus" ", MsgBoxMostrarMe nsaje); " & _ "function MsgBoxMostrarMe nsaje() { " & _ "if (MsgBoxTextoMen saje) { " & _ "if (MsgBoxTextoMen saje != """") { " & _ "if (MsgBoxTipoMens aje==2) {" & _ " alert(MsgBoxTex toMensaje); " & _ "} else {" & _ "if (confirm(MsgBox TextoMensaje)) { " & _ miPostBackOnYes & _ "} else { " & _ miPostBackOnNo & _ "}} MsgBoxTextoMens aje=""""; " & _ " }}} </script>" End Function
<Security.Perm issions.Permiss ionSetAttribute (Security.Permi ssions.Security Action.Demand, Name:="FullTrus t")> _ Protected Overrides Sub Render(ByVal writer As System.Web.UI. HtmlTextWriter) If ModoDisenio(Me) Then writer.Write(Me .ID) Else If _Message <> String.Empty Then Dim miSB As System.Text.Str ingBuilder = New System.Text.St ringBuilder(_Me ssage) miSB.Replace(Mi crosoft.VisualB asic.vbCr, " "c) miSB.Replace(Mi crosoft.VisualB asic.vbLf, " "c) miSB.Replace("" "", "'"c)
If miSB.ToString.S tartsWith("ÑaÑa ") Then Me.Page.Respons e.Write("<scrip t>MsgBoxTipoMen saje=1; MsgBoxTextoMen saje=""" + _ miSB.ToString.S ubstring(4) + """;</script>") Else Me.Page.Respons e.Write("<scrip t>MsgBoxTipoMen saje=2; MsgBoxTextoMen saje=""" + _ miSB.ToString + """;</script>") End If miSB = Nothing End If End If End Sub
Private Shared Function ModoDisenio(ByV al QueControl As _ System.Web.UI.W ebControls.WebC ontrol) As Boolean Dim DesignMode As Boolean = False Try DesignMode = QueControl.Site .DesignMode Catch : End Try Return DesignMode End Function
Public Sub RaisePostBackEv ent(ByVal eventArgument As String) _ Implements IPostBackEventH andler.RaisePos tBackEvent Select Case eventArgument.S ubstring(0, 3) Case "Yes" RaiseEvent YesChoosed(Me, eventArgument.S ubstring(3)) Case "No_" RaiseEvent NoChoosed(Me, eventArgument.S ubstring(3)) End Select End Sub
End Class
************** *************** *************** ****
You can save this code and generate a Component, after that I am using this code:
MsgBox1.ShowCo nfirmation("Do you want to delete this record?", "BORRAR", True, False)
AND if you click and SmartNavigation equal True the Windows will not comes up!
I realized that and some computers does not appear the window even if the NavigationSmar t is False !!!
Any Suggestions???? This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Chris Ruegsegger |
last post by:
I have a registration type page that asks a series of
questions but does so using Panels to display only a
couple at a time. I have a Next and Back button on each
panel for navigation purposes. Some of the next buttons
have Validation enabled for input checking.
SmartNavigation is set to True.
If I proceed a few Panels in to the registration and try
to backup using a Back button I get a script debug error
from IE stating a value is...
|
by: SLE |
last post by:
A web user control exposes a RadioButtonList (with AutoPostBack = true)
called "Question". This control also has an embedded RequiredFieldValidator
control.
1. Main ASPX page is populated with several "Questions".
2. Within the code of the main page, there is a SelectedIndexChanged handler
for the RadioButtonList exposed by Question. The function loops through a
number of questions on the pages and hides/shows questions (control.visible...
|
by: Sleepy |
last post by:
I have a situation where my stylesheet seems to be ignored when I set the smartNavigation property to True. Can someone please tell me what I'm doing wrong or how I should be doing this
I have a project with a stylesheet (Styles.css) in which I define a syle class. The start page is a frameset with a frame that points to a web form that is located in a sub-folder (i.e. MySubFolder\WebForm1.vb). This web form references the stylesheet in...
|
by: Brad |
last post by:
I have an aspx web page which initially displays fine. When I postback the
resulting response back to the client output is causing InternetExplorer 6
to crash. I've disabled the server side code for the submit button so what
is be going back to the client is just a recyling of the content. I used a
responsefilter to capture the initial content and the content which caused
IE to crash: Comparing the two files using a file compare...
|
by: Nestus |
last post by:
Hi, im developing a solution in ASP.Net, i have a page that i need to use
the smartnavigation in true, the problem occurs when i put in the directive
@Page SmartNavigation = true my page trhows a error in the next line, i
really dont understand why the page trhows that error. Here is the line that
make the error.
Response.Write("<script
language=javascript>window.parent.frames.location='OpcionReporte.a
spx';</script>")
| |
by: WJ |
last post by:
I have a web site with 2 pages under W2k3 box (IIS-6).
1. From WebForm1.Aspx.Button1Click, I issued
Response.Redirect("WebForm2.Aspx",true) - This works fine.
2. From WebForm2.Aspx.Button1Click, I issued
Response.Redirect("WebForm1.Aspx",true) - This gave me a 404 page not found.
The above error only occurs if my website is hosted by a proxy (my site is
running SSL cert and the SSL cert is also on the proxy box). However, all
the...
|
by: stacy |
last post by:
I used the wizard to upgrade an application from VB 6 to VB.net, the
following warnings appear around the .Input property of the MSCOmm
control
'UPGRADE_WARNING: Couldn't resolve default property of object
MSComm1.Input. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1037"'
When running the application, the following dialog comes up when a
|
by: Kewlpack |
last post by:
Okay - this is stumping me. I've used .Net since 1.0 release and never had
this trouble before...
In one of my new projects, if I enable the SmartNavigation="True" in the
Page declaration/directive tag - when I go to test the page it goes into an
infinite loop (in debugger I've tried to break at the Page_Load method but
the loop occurs before the method can even be reached)!
I've rebooted the server...
|
by: cmay |
last post by:
I have just started created a web app in asp.net 2.0.
I am using a masterpage for header/footer stuff.
In my content page I am using MaintainScrollPositionOnPostback, and
while it does keep the scroll position there is a lot of flicker on
postback where as when I did this with asp.net 1.1 you could hardly
tell that a postback has happening.
Is there something else I need to do or did ASP.NET 2.0 remove the
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |