Article View: alt.pl.comp.lang.csharp
Article #129Re: [ASP.NET] Messagebox
From: Robert Krassowski
Date: Wed, 08 Oct 2003 11:46
Date: Wed, 08 Oct 2003 11:46
52 lines
2325 bytes
2325 bytes
"S�awomir Partyka" <slawomir.par...@ecg.com.pl> wrote in message
news:bluugb$1r9k$1@news.mm.pl...
> Jak w C# i ASP.NET wy�wietli� okno dialogowe typu MessageBox?
Sklecilem cos takiego (na bazie kodu znalezionego niedawno w sieci).
Wiedzialem, ze sie kiedys przyda, jak nie mi to komus innemu :) Mysle ze z
przerobieniem tego na C# nie bedziesz mial problemu :)
-------------
Private Function MsgBoxJS(ByVal strMessage As String) As Long
' strMessage: Wiadomosc do wyswietlenia.
' Sukces: 0 (true)
' Blad: -1 (false)
Dim strBuider As New System.Text.StringBuilder
Try
If InStr(strMessage, "'") Then Throw New System.Exception("Apostrophe
Exception")
strBuider.Append("<script>")
strBuider.Append(Environment.NewLine)
strBuider.Append("alert('" & strMessage & "');")
strBuider.Append(Environment.NewLine)
strBuider.Append("</" + "script>")
Page.RegisterStartupScript("MsgBoxJS", strBuider.ToString())
Return True
Catch ex As Exception
Return False
End Try
End Function
-------------
Pasuje? :) Bo mozna kombinowac jeszcze inaczej. Tylko nie wiem jaki efekt, bo
nie sprawdzalem...
-------------
btnSubmitAttributes.Add("onclick", "alert('You clicked the button!')")
--
Pzdr.
RK.
Technical Details
Message-ID:
<bm0th8$997$1@inews.gazeta.pl>Path:
mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!news.gazeta.pl!not-for-mailReferences:
<bluugb$1r9k$1@news.mm.pl>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.tpinternet.pl!news.gazeta.pl!not-for-mail From: "Robert Krassowski" <robe...@cen.ter.tel.pl> Newsgroups: alt.pl.comp.lang.csharp,ms-news.pl.programowanie.dotnet Subject: Re: [ASP.NET] Messagebox Date: Wed, 8 Oct 2003 13:46:59 +0200 Organization: Portal Gazeta.pl -> http://www.gazeta.pl Lines: 55 Message-ID: <bm0th8$997$1@inews.gazeta.pl> References: <bluugb$1r9k$1@news.mm.pl> Reply-To: "Robert Krassowski" <robe...@cen.ter.tel.pl> NNTP-Posting-Host: gprs1.idea.pl X-Trace: inews.gazeta.pl 1065613675 9511 194.9.223.27 (8 Oct 2003 11:47:55 GMT) X-Complaints-To: use...@agora.pl NNTP-Posting-Date: Wed, 8 Oct 2003 11:47:55 +0000 (UTC) X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165 X-Priority: 3 X-User: robert.krassowski X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1158 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit