Professional Web Applications Themes

How to run javaScript on Server control - ASP.NET General

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.doent.myform.hdnVal.value=hdvalue windowHandle.focus(); return false; }...

  1. #1

    Default How to run javaScript on Server control

    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.doent.myform.hdnVal.value=hdvalue

    windowHandle.focus();
    return false;


    }
    Yuriy Guest

  2. #2

    Default Re: How to run javaScript on Server control

    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","openWind ow('./MyForm.aspx','hdBut1
    ')");

    Good luck!


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



    "Yuriy" <com> wrote in message
    news:01a801c36b3e$18ae0cf0$gbl... 


    Ray Guest

  3. #3

    Default Re: How to run javaScript on Server control

    Thank you for advice 
    programmatically via the 
    would look 
    ('./MyForm.aspx','hdBut1 [/ref]
    Text="Add 
    >
    >
    >.
    >[/ref]
    Yuriy Guest

Similar Threads

  1. using javascript in User controls to access server controls of the user control
    By Faizan Ahmed in forum ASP.NET Building Controls
    Replies: 1
    Last Post: January 4th, 04:09 PM
  2. Replies: 0
    Last Post: November 9th, 02:17 AM
  3. Changing a server control property using JavaScript
    By Dave in forum ASP.NET Building Controls
    Replies: 1
    Last Post: November 4th, 04:00 PM
  4. can user control change its child control's property using javascript?
    By chaoy@pacbell.net in forum ASP.NET Building Controls
    Replies: 0
    Last Post: August 25th, 02:31 AM
  5. Building a custom control that implement table server control
    By Thomas Ekegren in forum ASP.NET Building Controls
    Replies: 4
    Last Post: July 22nd, 06:29 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139