|
 |
asptoday_discuss thread: JavaScript and ASP.NET/ASP
Message #1 by "Michael Bell" <michaeljbell@b...> on Wed, 30 Oct 2002 15:12:37
|
|
Hi,
I have a bit of a dummies question here!
A form within my asp.net application has a delete button which will delete
the current record when clicked. Prior to record deletion, I have got a
javascript confirm box appearing where the user can click on OK or Cancel.
This works fine with the true or false return values been handled
appropriately.
My problem though is that the confirm dialogue currently displays the
text: "Are you sure you want to delete the category x?" where x is the
category name.
I want to display on a new line some further text but can not seem to get
this to work. I have tried using \n but this gives me an error. Also I
would like to place text in the dialogue header to replace the 'Microsoft
Internet Explorer' text.
Code output is:
---------------
<a onclick="javascript:return confirm('Are you sure you want to delete the
primary category: Technical?');" href="javascript:__doPostBack
('PrimaryDocCats:_ctl9:_ctl1','')">Delete?</a>
If anyone can help that would be great.
Regards,
Michael
Message #2 by "Dave Cranwell" <david@t...> on Wed, 30 Oct 2002 15:14:35 -0000
|
|
As a rule of thumb, any javascript that is more complicated than a
history.go i tend to put in a <script> block elsewhere on the page then call
it; but after cutting and pasting your code into my own window i can see
nothing wrong. Also i can't create any errors. I'm testing it with CF, not
ASP, but the principal is identical. My code (on a completely blank page)
looks like this...
<cfset foo= "bar">
<a onclick="javascript:return confirm('Are you sure you want to delete the
primary category: <cfoutput>#foo#</cfoutput>?\nWahey i\'m on a new line!');"
href="javascript:__doPostBack('PrimaryDocCats:_ctl9:_ctl1','')">Delete?</a>
....and it works without fail.
Unfortunately, javascript doesn't support the relabelling of dialogs like
you want.
I'd suggest it may be a browser problem, although i've no idea what!
--------------------------
Dave Cranwell
Torchbox Ltd
david@t...
tel: (+44) 1608 811 870
mob: (+44) 7760 438 708
http://www.torchbox.com
----- Original Message -----
From: "Michael Bell" <michaeljbell@b...>
To: "ASPToday Discuss" <asptoday_discuss@p...>
Sent: Wednesday, October 30, 2002 3:12 PM
Subject: [asptoday_discuss] JavaScript and ASP.NET/ASP
> Hi,
>
> I have a bit of a dummies question here!
>
> A form within my asp.net application has a delete button which will delete
> the current record when clicked. Prior to record deletion, I have got a
> javascript confirm box appearing where the user can click on OK or Cancel.
>
> This works fine with the true or false return values been handled
> appropriately.
>
> My problem though is that the confirm dialogue currently displays the
> text: "Are you sure you want to delete the category x?" where x is the
> category name.
>
> I want to display on a new line some further text but can not seem to get
> this to work. I have tried using \n but this gives me an error. Also I
> would like to place text in the dialogue header to replace the 'Microsoft
> Internet Explorer' text.
>
> Code output is:
> ---------------
> <a onclick="javascript:return confirm('Are you sure you want to delete the
> primary category: Technical?');" href="javascript:__doPostBack
> ('PrimaryDocCats:_ctl9:_ctl1','')">Delete?</a>
>
>
> If anyone can help that would be great.
>
> Regards,
> Michael
>
|
|
 |