How to populate PlaceHolder

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

MS News \(MS ILM\)

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

Yuriy

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





.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top