creating button onclick events programmatically

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • barry

    creating button onclick events programmatically

    Is it possible to create the following programmaticall y

    Button27.Attrib utes("onClick") = "javascript:abc ();"

    without creating a separate line for each

    Button27.Attrib utes("onClick") = "javascript:abc ();"
    Button28.Attrib utes("onClick") = "javascript:abc ();"
    etc

    thanks
    barry


  • S. Justin Gengo

    #2
    Re: creating button onclick events programmaticall y

    Barry,

    You could write a loop that searches for each button and adds the
    javascript.

    Dim ButtonFound As Button
    Dim ButtonCount, ButtonLoop As Int32
    ButtonCount = 28

    For ButtonLoop = 1 To 28
    ButtonFound = Page.FindContro l("Button" & ButtonLoop.ToSt ring)
    ButtonFound.Att ributes.Add("on Click", "javascript:abc ();")
    Next

    --
    Sincerely,

    S. Justin Gengo, MCP
    Web Developer / Programmer



    "Out of chaos comes order."
    Nietzsche
    "barry" <flagisup@ix.ne tcom.com> wrote in message
    news:%23ts1hIt0 FHA.3420@TK2MSF TNGP10.phx.gbl. ..[color=blue]
    > Is it possible to create the following programmaticall y
    >
    > Button27.Attrib utes("onClick") = "javascript:abc ();"
    >
    > without creating a separate line for each
    >
    > Button27.Attrib utes("onClick") = "javascript:abc ();"
    > Button28.Attrib utes("onClick") = "javascript:abc ();"
    > etc
    >
    > thanks
    > barry
    >
    >[/color]


    Comment

    • barry

      #3
      Re: creating button onclick events programmaticall y

      Thank you very much.
      "S. Justin Gengo" <justin@[no_spam_please]aboutfortunate. com> wrote in
      message news:uRilSox0FH A.3892@TK2MSFTN GP12.phx.gbl...[color=blue]
      > Barry,
      >
      > You could write a loop that searches for each button and adds the
      > javascript.
      >
      > Dim ButtonFound As Button
      > Dim ButtonCount, ButtonLoop As Int32
      > ButtonCount = 28
      >
      > For ButtonLoop = 1 To 28
      > ButtonFound = Page.FindContro l("Button" & ButtonLoop.ToSt ring)
      > ButtonFound.Att ributes.Add("on Click", "javascript:abc ();")
      > Next
      >
      > --
      > Sincerely,
      >
      > S. Justin Gengo, MCP
      > Web Developer / Programmer
      >
      > www.aboutfortunate.com
      >
      > "Out of chaos comes order."
      > Nietzsche
      > "barry" <flagisup@ix.ne tcom.com> wrote in message
      > news:%23ts1hIt0 FHA.3420@TK2MSF TNGP10.phx.gbl. ..[color=green]
      > > Is it possible to create the following programmaticall y
      > >
      > > Button27.Attrib utes("onClick") = "javascript:abc ();"
      > >
      > > without creating a separate line for each
      > >
      > > Button27.Attrib utes("onClick") = "javascript:abc ();"
      > > Button28.Attrib utes("onClick") = "javascript:abc ();"
      > > etc
      > >
      > > thanks
      > > barry
      > >
      > >[/color]
      >
      >[/color]


      Comment

      Working...