PC Review


Reply
Thread Tools Rate Thread

alert box in asp.net

 
 
sonu
Guest
Posts: n/a
 
      19th Sep 2005
How can we use alert and confirm method in asp.net application.

i am working with application where i want to use confirm box before
going for any operation. and same for alert box

Sonu

 
Reply With Quote
 
 
 
 
Ollie Riches
Guest
Posts: n/a
 
      19th Sep 2005
have a look at this:

http://www.binaryshift.com/DisplayPo...ick/Index.aspx

HTH

Ollie Riches

"sonu" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> How can we use alert and confirm method in asp.net application.
>
> i am working with application where i want to use confirm box before
> going for any operation. and same for alert box
>
> Sonu
>



 
Reply With Quote
 
Usenet User
Guest
Posts: n/a
 
      19th Sep 2005
On 19 Sep 2005 09:30:14 -0700, "sonu" <(E-Mail Removed)> wrote:

>How can we use alert and confirm method in asp.net application.
>
>i am working with application where i want to use confirm box before
>going for any operation. and same for alert box
>
>Sonu


Dealing with popup windows can be tricky and not safe (popup blockers
may negate your efforts.)

The easiest way would be to employ the "confirm" statement in
client-side javascript.

For example, consider the most common case - adding a confirmation
dialog when user attempts to delete a record from a datagrid (gridList
below) on ASP.NET page. The server-side event handler will only
execute if the user clicks "yes" on the client-side, causing the event
to fire:

In your HTML:

<asp:TemplateColumn>
<ItemTemplate>
<asp:LinkButton id="linkDelete" runat="server"
CommandName="Delete">Delete</asp:LinkButton>
</ItemTemplate>
</asp:TemplateColumn>


In your code behind:

// The below will add a confirmation dialog
// to each linkDelete instance at runtime
private void gridList_ItemDataBound(object sender,
DataGridItemEventArgs e )
{
if( e.Item.FindControl("linkDelete") !+ null )
{
LinkButton deleteButton =
e.Item.FindControl("linkDelete") as LinkButton;

deleteButton.Attributes.Add( "onclick",
@"javascript:return confirm('Are you sure you want to delete this
record?');" )

}
}

private void gridList_DeleteCommand( object source,
DataGridCommandEventArgs e )
{
// Delete the record here
}
 
Reply With Quote
 
=?Utf-8?B?TmF6ZWVy?=
Guest
Posts: n/a
 
      21st Sep 2005
this is in asp.net and language is vb
Public Shared Sub Alert(ByRef aspxPage As System.Web.UI.Page, ByVal
strMessage As String)
Dim strScript As String = "<script language=JavaScript>alert('" &
strMessage & "')</script>"
If (Not aspxPage.IsStartupScriptRegistered("strKey1")) Then
aspxPage.RegisterStartupScript("strKey1", strScript)
End If
End Sub

the above function is a public shared function which accepts page in which
alert is required and second param is of the message which you want to
dispaly.....
if u write this function in a class then call the class.function name with
params that should work.

For example if i wirte above code in "uitl .class"
then while calling i have to from webform as util.Alert(me, "Hello World")

"sonu" wrote:

> How can we use alert and confirm method in asp.net application.
>
> i am working with application where i want to use confirm box before
> going for any operation. and same for alert box
>
> Sonu
>
>

 
Reply With Quote
 
=?Utf-8?B?TmF6ZWVy?=
Guest
Posts: n/a
 
      21st Sep 2005
for confirm box

Public Shared Sub Confirm(ByRef btn As WebControls.Button, ByVal strMessage
As String)
btn.Attributes.Add("onclick", "return confirm('" & strMessage & "');")
End Sub

write this code in a static class called util
in webform load you have to map the particular event to this confirm box
with the following systax
Me.button.Attributes.Add("onclick", "return confirm('Your message goes
here');")

this above code should work, further quires feel free to contact
(E-Mail Removed)

"sonu" wrote:

> How can we use alert and confirm method in asp.net application.
>
> i am working with application where i want to use confirm box before
> going for any operation. and same for alert box
>
> Sonu
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Use this important VIRUS ALERT - VIRUS ALERT - W32.Swen.A@mm Worm - VIRUS ALERT - VIRUS ALERT - VIRUS ALERT - VIRUS ALERT nemo Microsoft VC .NET 0 3rd Nov 2003 08:34 PM
Re: See update - VIRUS ALERT - VIRUS ALERT - W32.Swen.A@mm Worm - VIRUS ALERT - VIRUS ALERT - VIRUS ALERT - VIRUS ALERT nemo Microsoft Dot NET Framework 0 12th Oct 2003 01:29 PM
Re: See update - VIRUS ALERT - VIRUS ALERT - W32.Swen.A@mm Worm - VIRUS ALERT - VIRUS ALERT - VIRUS ALERT - VIRUS ALERT nemo Microsoft Outlook Contacts 0 12th Oct 2003 01:29 PM
Re: See update - VIRUS ALERT - VIRUS ALERT - W32.Swen.A@mm Worm - VIRUS ALERT - VIRUS ALERT - VIRUS ALERT - VIRUS ALERT nemo Windows XP Print / Fax 0 12th Oct 2003 01:29 PM
Re: See update - VIRUS ALERT - VIRUS ALERT - W32.Swen.A@mm Worm - VIRUS ALERT - VIRUS ALERT - VIRUS ALERT - VIRUS ALERT nemo Windows XP Photos 0 12th Oct 2003 01:29 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:08 AM.