How to populate PlaceHolder

  • Thread starter Thread starter Yuriy
  • Start date Start date
Y

Yuriy

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.
..
 
cmdDelete.Attributes.Add("onClick", "javascript:return confirm('Are You Sure
You Wish To Delete This Item ?');")
 
Thank you. Exactly what i need.
-----Original Message-----
cmdDelete.Attributes.Add("onClick", "javascript:return confirm('Are You Sure
You Wish To Delete This Item ?');")





.
 
Back
Top