Professional Web Applications Themes

How to populate PlaceHolder - ASP.NET General

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 ...

  1. #1

    Default How to populate PlaceHolder

    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 Guest

  2. #2

    Default Re: How to populate PlaceHolder

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


    "Yuriy" <com> wrote in message
    news:083c01c36985$10efe570$gbl... 


    MS Guest

  3. #3

    Default Re: How to populate PlaceHolder

    Thank you. Exactly what i need. 
    confirm('Are You Sure [/ref]
    html [/ref]
    the [/ref]
    create [/ref]
    script) 
    >
    >
    >.
    >[/ref]
    Yuriy Guest

  4. #4

    Default Re: How to populate PlaceHolder

    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" <com> wrote in message
    news:083c01c36985$10efe570$gbl... 



    David Guest

Similar Threads

  1. Usercontorl in a placeholder
    By Pradeep in forum ASP.NET Building Controls
    Replies: 1
    Last Post: November 3rd, 11:34 PM
  2. Build control in a placeholder or like a placeholder
    By nail in forum ASP.NET Building Controls
    Replies: 0
    Last Post: September 10th, 07:57 PM
  3. 4GL V7.31 placeholder problem?
    By Malc P in forum Informix
    Replies: 8
    Last Post: October 19th, 11:12 PM
  4. Placeholder Question
    By trinitypete in forum ASP.NET General
    Replies: 2
    Last Post: July 1st, 12:42 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