473,748 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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:ImageButto n ID="cmdDeleteLo gin" runat="server"
SkinID="DeleteB utton" CommandName="De leteLogin"
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$Con tentPlaceHolder $repLogins$ctl0 1$cmdEditLogin"
id="ctl00_Conte ntPlaceHolder_r epLogins_ctl01_ cmdEditLogin"
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.clearscre en.com/ragc/archive/2004/10/28/525.aspxbut
there's no clue as to what the solution might be.

Nov 6 '06 #1
2 3393
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:ImageButto n ID="cmdDeleteLo gin" runat="server"
SkinID="DeleteB utton" CommandName="De leteLogin"
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$Con tentPlaceHolder $repLogins$ctl0 1$cmdEditLogin"
id="ctl00_Conte ntPlaceHolder_r epLogins_ctl01_ cmdEditLogin"
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.clearscre en.com/ragc/archive/2004/10/28/525.aspxbut
there's no clue as to what the solution might be.
Nov 6 '06 #2
On 6 Nov 2006 11:33:43 -0800, "Superman" <br*****@ungern et.comwrote:
>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:

OnClientClic k ='<%# 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:ImageButto n ID="cmdDeleteLo gin" runat="server"
SkinID="DeleteB utton" CommandName="De leteLogin"
CommandArgument ='<%# Eval("LoginID") %>'
OnClientClick ='<%# System.String.F ormat("return confirm('Are you
certain you want to delete: {0} ?')", Eval("UserName" )) %>' />
Nov 7 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
22532
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object instance (in this case 'myDog'). Of course it would be better if I could somehow know from within write() that the name of the object instance was 'myDog' without having to pass it as a parameter. //////////////////////////////// function...
8
3118
by: Brendan Reynolds | last post by:
I'm trying to integrate SQL Server Reporting Services reports into an ASP.NET app (SRS 2000, ASP.NET 1.1). I know how to do this using direct URL addressing, but this exposes in the query string parameters that should not be exposed. Each user is associated with a school, and should see only that school's data. When the user logs in, I retrieve the SchoolID associated with that user, and that SchoolID is used as a parameter in all stored...
5
4784
by: Casey | last post by:
Hello, Can someone give me specific code to replace text on a page using server side javascript? I need to use server-side because I need the output to be recognized in the final HTML so that google can index it. Here is a specific example of what I want to do: <div id=SomeText> Here is some text. I went to the baseball game </div>
7
6285
by: Alex Maghen | last post by:
I have some client-side JavaScript that I want to run whenever a pulldown <SELECT> is changes on th client. I'm trying to do this as follows... <select id="MyPulldown" onchange="handleProblemChange();" runat="server"> If I do this, I get client-side javascript errors because the id "MyPulldown" doesn't exist. It's been mangled into this crazy-named thing that I can't use. How do I fix this so that the ID that I give it ends up being...
5
3977
by: visu | last post by:
Hi this is a question asked in this group two years back.. No answer for this question till date. now i am in the same situation of the questioner.. to find a solution for this problem. Can any one help me in this regard.? The question is: ---------------------------------------------------------------------------------------------------- Wondering if anyone can tell me if it's possible to have Javascript
5
2814
by: =?Utf-8?B?VmFubmk=?= | last post by:
Hi, I have a component where I need to have thread-safe access to a list. Operations on the list are done in critical sections (lock (lockObject) { ... } ) in the usual way, to make sure that no other thread will modify the list while operations are running. However, I at the end of the critical section, I need to fire an OnChange type of event, publishing the changed list item as part of my custom EventArgs. I want to be certain that...
19
2235
by: maya | last post by:
hi, so what is "modern" javascript?? the same as "DOM-scripting"? i.e., editing content (or changing appearance of content) dynamically by massaging javascript objects, html elements, etc? (in conjunction with css, you know, the usual...;) this is what is meant by "modern" javascript?? so how do folks feel about this who think javascript is so evil they disable it from their browsers?? do sites designed with "modern" javascript...
0
8996
marktang
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...
0
9562
Oralloy
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...
0
9386
jinu1996
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...
0
9254
tracyyun
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...
1
6799
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4608
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4879
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3319
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.