Groups | Blog | Home
all groups > asp.net > june 2004 >

asp.net : attribute concatenation problem


Pinkesh Achhodwala via .NET 247
6/13/2004 11:37:50 PM
hi all, please see the followin line :

<input type="submit" name="btnRemove" value="Remove" onclick="if (typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); " language="javascript" id="btnRemove" class="button" onClick="alert(2);" />

In above line, u can see that onclick event is called twice. why it is so?
If i want to concatenate it, what should i do?
Please reply me, if u have the solution.
Thanks.
--------------------------------
From: Pinkesh Achhodwala

-----------------------
Posted by a user from .NET 247 (http://www.dotnet247.com/)

srini
6/14/2004 12:12:01 AM
Hi,
write this code on the page load
btnRemove.Attributes.Add("OnClick", "alert(2);")
Hope it helps.
--
The best
srini


[quoted text, click to view]
adnan boz
6/14/2004 10:32:27 AM
Hi,
Concatenate all of your code in a js function.
Sample is below.

Good Luck
Adnan

<input ... onclick="myclick();" ... >

<script language=javascript>
function myclick(){
if (typeof(Page_ClientValidate) == 'function')
Page_ClientValidate();
alert(2);
}
<script>



[quoted text, click to view]
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="btnRemove" class="button" onClick="alert(2);" />
[quoted text, click to view]

AddThis Social Bookmark Button