How to populate PlaceHolder

Discussion in 'ASP .Net' started by Yuriy, Aug 23, 2003.

  1. Yuriy

    Yuriy Guest

    Hello!
    I need populate PlaceHolder control dynamicaly and some
    of the control should be server controls and regular html
    controls. I try to do it but could not found methods to
    add javascript to it.
    There is a good approach to writing HTML elements to the
    output argument. We can use the Write methods to add
    HTML directly to the HtmlTextWriter. For ex. i need create
    button that displays a message box when the user clicks
    it. How I can add HTML with button and javascript to
    PlaceHolder control?

    Public Class Alert
    Inherits System.Web.UI.WebContros.WebControl

    Protected Overrides Sub Render(ByVal output as
    HtmlTextWriter)
    output.Write("<H3>My Alert Control</H3>")
    output.WriteBeginTag("INPUT")
    output.WriteAttribute("value","My Control")
    output.WriteAttribute("type","button")
    output.WriteAttribute("onclick","Javascript:alert
    ("Hello!")")
    output.WriteEndTag("INPUT")
    End Class

    Actually, I need add a couple controls to Placeholder
    control and one of them server control(with java script)
    and another regular HTML control.
    If you know some examples or links very thanks.
    Thank you.
    ..
     
    Yuriy, Aug 23, 2003
    #1
    1. Advertising

  2. cmdDelete.Attributes.Add("onClick", "javascript:return confirm('Are You Sure
    You Wish To Delete This Item ?');")


    "Yuriy" <> wrote in message
    news:083c01c36985$10efe570$...
    > Hello!
    > I need populate PlaceHolder control dynamicaly and some
    > of the control should be server controls and regular html
    > controls. I try to do it but could not found methods to
    > add javascript to it.
    > There is a good approach to writing HTML elements to the
    > output argument. We can use the Write methods to add
    > HTML directly to the HtmlTextWriter. For ex. i need create
    > button that displays a message box when the user clicks
    > it. How I can add HTML with button and javascript to
    > PlaceHolder control?
    >
    > Public Class Alert
    > Inherits System.Web.UI.WebContros.WebControl
    >
    > Protected Overrides Sub Render(ByVal output as
    > HtmlTextWriter)
    > output.Write("<H3>My Alert Control</H3>")
    > output.WriteBeginTag("INPUT")
    > output.WriteAttribute("value","My Control")
    > output.WriteAttribute("type","button")
    > output.WriteAttribute("onclick","Javascript:alert
    > ("Hello!")")
    > output.WriteEndTag("INPUT")
    > End Class
    >
    > Actually, I need add a couple controls to Placeholder
    > control and one of them server control(with java script)
    > and another regular HTML control.
    > If you know some examples or links very thanks.
    > Thank you.
    > .
    >
    >
     
    MS News \(MS ILM\), Aug 23, 2003
    #2
    1. Advertising

  3. Yuriy

    Yuriy Guest

    Thank you. Exactly what i need.
    >-----Original Message-----
    >cmdDelete.Attributes.Add("onClick", "javascript:return

    confirm('Are You Sure
    >You Wish To Delete This Item ?');")
    >
    >
    >"Yuriy" <> wrote in message
    >news:083c01c36985$10efe570$...
    >> Hello!
    >> I need populate PlaceHolder control dynamicaly and some
    >> of the control should be server controls and regular

    html
    >> controls. I try to do it but could not found methods to
    >> add javascript to it.
    >> There is a good approach to writing HTML elements to

    the
    >> output argument. We can use the Write methods to add
    >> HTML directly to the HtmlTextWriter. For ex. i need

    create
    >> button that displays a message box when the user clicks
    >> it. How I can add HTML with button and javascript to
    >> PlaceHolder control?
    >>
    >> Public Class Alert
    >> Inherits System.Web.UI.WebContros.WebControl
    >>
    >> Protected Overrides Sub Render(ByVal output as
    >> HtmlTextWriter)
    >> output.Write("<H3>My Alert Control</H3>")
    >> output.WriteBeginTag("INPUT")
    >> output.WriteAttribute("value","My Control")
    >> output.WriteAttribute("type","button")
    >> output.WriteAttribute("onclick","Javascript:alert
    >> ("Hello!")")
    >> output.WriteEndTag("INPUT")
    >> End Class
    >>
    >> Actually, I need add a couple controls to Placeholder
    >> control and one of them server control(with java

    script)
    >> and another regular HTML control.
    >> If you know some examples or links very thanks.
    >> Thank you.
    >> .
    >>
    >>

    >
    >
    >.
    >
     
    Yuriy, Aug 24, 2003
    #3
  4. Yuriy

    David Wier Guest

    This code sample shows how to add both server controls and HTML tags to a
    placeholder:
    http://aspnet101.com/aspnet101/aspnet/codesample.aspx?code=dynamicTextBoxes

    David Wier
    http://aspnet101.com
    http://aspexpress.com


    "Yuriy" <> wrote in message
    news:083c01c36985$10efe570$...
    > Hello!
    > I need populate PlaceHolder control dynamicaly and some
    > of the control should be server controls and regular html
    > controls. I try to do it but could not found methods to
    > add javascript to it.
    > There is a good approach to writing HTML elements to the
    > output argument. We can use the Write methods to add
    > HTML directly to the HtmlTextWriter. For ex. i need create
    > button that displays a message box when the user clicks
    > it. How I can add HTML with button and javascript to
    > PlaceHolder control?
    >
    > Public Class Alert
    > Inherits System.Web.UI.WebContros.WebControl
    >
    > Protected Overrides Sub Render(ByVal output as
    > HtmlTextWriter)
    > output.Write("<H3>My Alert Control</H3>")
    > output.WriteBeginTag("INPUT")
    > output.WriteAttribute("value","My Control")
    > output.WriteAttribute("type","button")
    > output.WriteAttribute("onclick","Javascript:alert
    > ("Hello!")")
    > output.WriteEndTag("INPUT")
    > End Class
    >
    > Actually, I need add a couple controls to Placeholder
    > control and one of them server control(with java script)
    > and another regular HTML control.
    > If you know some examples or links very thanks.
    > Thank you.
    > .
    >
    >
     
    David Wier, Aug 26, 2003
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. trinitypete

    Placeholder Question

    trinitypete, Jul 1, 2003, in forum: ASP .Net
    Replies:
    2
    Views:
    1,087
    trinitypete
    Jul 1, 2003
  2. John
    Replies:
    1
    Views:
    373
    zPaul
    Jul 1, 2003
  3. John
    Replies:
    2
    Views:
    466
    William F. Robertson, Jr.
    Jul 2, 2003
  4. nail

    Build control in a placeholder or like a placeholder

    nail, Sep 10, 2004, in forum: ASP .Net Building Controls
    Replies:
    0
    Views:
    346
  5. Enjoy Life
    Replies:
    2
    Views:
    283
    Roland Hall
    Feb 23, 2005
Loading...

Share This Page