How to run javaScript on Server control

Y

Yuriy

I need run Java Script on Server Control. I wrote the
following :
<asp:button id="btnMemAddChange1" runat="server" Text="Add
Family Member 1" Width="146px" onclick="openWindow
('./MyForm.aspx','hdBut1')"></asp:button>

It doesn't work "Compilation Error"


There is a javaScript code is working good.

var windowHandle;
function openWindow(myform,sHdnValue) {
var hdvalue;
hdvalue=sHdnValue

if(windowHandle!=null && !
windowHandle.closed){
windowHandle.close();
}
windowHandle=window.open
(myform,'HouseholdMember', 'toolbar=yes, location=no,
status=yes, menubar=no, resizable=yes, scrollbars=yes,
width=500, height=400');
windowHandle.document.myform.hdnVal.value=hdvalue

windowHandle.focus();
return false;


}
 
R

Ray Dixon [MVP]

Hi Yuriy,

Try adding the information for the onclick event programmatically via the
Attributes collection of the bntMemAddChange1 button. It would look
something like this (this is in C#):

btnMemAddChange.Attributes.Add("onclick","openWindow('./MyForm.aspx','hdBut1
')");

Good luck!
 
Y

Yuriy

Thank you for advice
-----Original Message-----
Hi Yuriy,

Try adding the information for the onclick event programmatically via the
Attributes collection of the bntMemAddChange1 button. It would look
something like this (this is in C#):

btnMemAddChange.Attributes.Add("onclick","openWindow ('./MyForm.aspx','hdBut1
')");

Good luck!


--
Ray Dixon - Microsoft MVP
(e-mail address removed)
(remove NOSPAM. from my e-mail address for a direct reply)






.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top