How to run javaScript on Server control

  • Thread starter Thread starter Yuriy
  • Start date Start date
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;


}
 
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!
 
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)






.
 
Back
Top