adding dynamic content to a button

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default adding dynamic content to a button

    Hi. I am having a small problem. I am trying to add a
    dynamic attribute to a regular html button, but I also
    have a runat="server" attribute on it because at one
    point it's invisible, and I make it visible...
    Everything works when I take out runat="server", but when
    I leave it, it actually prints out lblSSN.Text rather
    than substituting it with a number. Here is the code

    <input type="button" runat="server"
    id="buttonAddGuardian" value="Add Guardian"
    onClick="window.open('addguardian.aspx?id=<%=lblSS N.Text%
    >');"/>
    I would like the HTML source look like window.open
    ('addguardian.aspx?id=123456789') Thank you.
    Steven Guest

  2. Similar Questions and Discussions

    1. Dynamically adding Dropdown, Text Box, Add Button and Remove Button
      Hi Everyone, I am facing a poblem in creating a row which contains following scenario in ASP.NET |DROP_DOWN_LIST | |TEXT_BOX| ...
    2. adding a hyperlink to flash content
      i have a small flash (swf) file inseted onto my dreamweaver document is it possible to hyperlink this to another page?
    3. Adding a second button if the first button is clicked
      Hi I build my form dynamically in Page_Load, with a button If the user clicks the button I want to create another button. I can do this but the...
    4. Adding literal content to webcontrol via editor
      Hi Experts. I developed a menu webcontrol, which can be constrcuted by inline XML, something like that: <cc1:menu runat=server id=....>...
    5. Adding content to a shockwave website
      I have a website that I created in Director 9 MX and I can't figure out how to add a content box for text and pics that is scrollable. any help...
  3. #2

    Default Re: adding dynamic content to a button

    Steven,

    Instead of placing the window.open parameter the way you are doing set it
    using the attributes method of the button in the codebehind page.

    buttonAddGuardian.Attributes.Add("onClick",
    "javascript:window.open('addguardian.aspx?id=" & lblSSN.Text & "');")

    Sincerely,

    --
    S. Justin Gengo, MCP
    Web Developer

    Free code library at:
    [url]www.aboutfortunate.com[/url]

    "Out of chaos comes order."
    Nietzche


    "Steven" <stevenzilberman@alum.rpi.edu> wrote in message
    news:08de01c3601f$03ada470$a501280a@phx.gbl...
    > Hi. I am having a small problem. I am trying to add a
    > dynamic attribute to a regular html button, but I also
    > have a runat="server" attribute on it because at one
    > point it's invisible, and I make it visible...
    > Everything works when I take out runat="server", but when
    > I leave it, it actually prints out lblSSN.Text rather
    > than substituting it with a number. Here is the code
    >
    > <input type="button" runat="server"
    > id="buttonAddGuardian" value="Add Guardian"
    > onClick="window.open('addguardian.aspx?id=<%=lblSS N.Text%
    > >');"/>
    >
    > I would like the HTML source look like window.open
    > ('addguardian.aspx?id=123456789') Thank you.

    S. Justin Gengo Guest

Posting Permissions

  • You may not post new threads
  • You may 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