Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How do I include a server tag within a javascript parameter which is itself within a HTML element event?

Reply
Thread Tools

How do I include a server tag within a javascript parameter which is itself within a HTML element event?

 
 
mark4asp
Guest
Posts: n/a
 
      11-06-2006
How do I include a server tag within a javascript parameter which is
itself within a HTML element event.

For instance no matter what permutation of quotes I try here I get
errors on this line:

<asp:ImageButton ID="cmdDeleteLogin" runat="server"
SkinID="DeleteButton" CommandName="DeleteLogin"
CommandArgument='<%# Eval("LoginID") %>'
OnClientClick =
'return confirm(Are you certain you want to delete: <%#
Eval("UserName") %>)' />

I want the final code to look something like this:

<input type="image"
name="ctl00$ContentPlaceHolder$repLogins$ctl01$cmd EditLogin"
id="ctl00_ContentPlaceHolder_repLogins_ctl01_cmdEd itLogin"
src="../App_Themes/SomeSite_Admin/images/edit_button.gif"
onclick="return confirm('Are you certain you want to delete: Joe
Doe');"
style="border-width:0px;" />

Clearly the problem is that double quotes can't be used to enclose <%#
Eval("UserName") %> but I need to enclose the argument to the
javascript confirm function in qutoes.

I found out what the problem was here
<http://blogs.clearscreen.com/ragc/archive/2004/10/28/525.aspx> but
there's no clue as to what the solution might be.

 
Reply With Quote
 
 
 
 
Superman
Guest
Posts: n/a
 
      11-06-2006
Mark,

At first glance it looks like you're missing some single quotes (or
quotes around your confirm() call. The text is not wrapped!

If that doesn't yeild any results, this is how I do these types of
things:

OnClientClick ='<%# String.format("return confirm('Are you certain you
want to delete: {0} ?'", Eval("UserName"))%>' />


Good luck!

mark4asp wrote:
> How do I include a server tag within a javascript parameter which is
> itself within a HTML element event.
>
> For instance no matter what permutation of quotes I try here I get
> errors on this line:
>
> <asp:ImageButton ID="cmdDeleteLogin" runat="server"
> SkinID="DeleteButton" CommandName="DeleteLogin"
> CommandArgument='<%# Eval("LoginID") %>'
> OnClientClick =
> 'return confirm(Are you certain you want to delete: <%#
> Eval("UserName") %>)' />
>
> I want the final code to look something like this:
>
> <input type="image"
> name="ctl00$ContentPlaceHolder$repLogins$ctl01$cmd EditLogin"
> id="ctl00_ContentPlaceHolder_repLogins_ctl01_cmdEd itLogin"
> src="../App_Themes/SomeSite_Admin/images/edit_button.gif"
> onclick="return confirm('Are you certain you want to delete: Joe
> Doe');"
> style="border-width:0px;" />
>
> Clearly the problem is that double quotes can't be used to enclose <%#
> Eval("UserName") %> but I need to enclose the argument to the
> javascript confirm function in qutoes.
>
> I found out what the problem was here
> <http://blogs.clearscreen.com/ragc/archive/2004/10/28/525.aspx> but
> there's no clue as to what the solution might be.


 
Reply With Quote
 
 
 
 
Harry Haller
Guest
Posts: n/a
 
      11-07-2006
On 6 Nov 2006 11:33:43 -0800, "Superman" <(E-Mail Removed)> wrote:

>Mark,
>
>At first glance it looks like you're missing some single quotes (or
>quotes around your confirm() call. The text is not wrapped!
>
>If that doesn't yeild any results, this is how I do these types of
>things:
>
>OnClientClick ='<%# String.format("return confirm('Are you certain you
>want to delete: {0} ?'", Eval("UserName"))%>' />


Thanks, I added a couple of bits which I thought should make it work
but they don't. I still ... I still get that error "server tag is not
well-formed". It's a mystery to me.

<asp:ImageButton ID="cmdDeleteLogin" runat="server"
SkinID="DeleteButton" CommandName="DeleteLogin"
CommandArgument='<%# Eval("LoginID") %>'
OnClientClick ='<%# System.String.Format("return confirm('Are you
certain you want to delete: {0} ?')", Eval("UserName")) %>' />
 
Reply With Quote
 
 
 
Reply

Thread Tools

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: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
obtain element name, or attribute and value of the document name itself, and some elemnts and attributes from an ancestor or the node itself using xquery Jeff Kish XML 4 10-30-2008 05:47 PM
/* #include <someyhing.h> */ => include it or do not include it?That is the question .... Andreas Bogenberger C Programming 3 02-22-2008 10:53 AM
how do u invoke Tag b's Tag Handler from within Tag a's tag Handler? shruds Java 1 01-27-2006 03:00 AM
Include or embed sound within an image file itself ? Steve Parus Digital Photography 1 08-29-2003 07:41 PM



Advertisments