473,407 Members | 2,598 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

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.
..
Nov 17 '05 #1
3 4772
cmdDelete.Attributes.Add("onClick", "javascript:return confirm('Are You Sure
You Wish To Delete This Item ?');")
"Yuriy" <yl******@hotmail.com> wrote in message
news:08****************************@phx.gbl...
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.
.

Nov 17 '05 #2
Thank you. Exactly what i need.
-----Original Message-----
cmdDelete.Attributes.Add("onClick", "javascript:return confirm('Are You SureYou Wish To Delete This Item ?');")
"Yuriy" <yl******@hotmail.com> wrote in message
news:08****************************@phx.gbl...
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.
.

.

Nov 17 '05 #3
This code sample shows how to add both server controls and HTML tags to a
placeholder:
http://aspnet101.com/aspnet101/aspne...namicTextBoxes

David Wier
http://aspnet101.com
http://aspexpress.com
"Yuriy" <yl******@hotmail.com> wrote in message
news:08****************************@phx.gbl...
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.
.


Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: blue | last post by:
I have a drop-down list, a radio button list and a submit button. I'm adding these controls to a table and I'm adding the table to a Placeholder. I'm adding it to the Placeholder because I don't...
2
by: Mike Speak | last post by:
I have a user control that I want to use to render 4 menu items (retrieved from db) on the top of each of my asp.net pages. The user control defines a table, with one TR and one TD. Within the...
1
by: Dan | last post by:
I have an asp.net page default.aspx with a user control and a placeholder control. <html> <body> <form id="myform" method="post" runat="server" /> <PageHeader:Header id="header1"...
2
by: Chad Crowder | last post by:
Is it possible to create a placeholder inside a template column of a datagrid? My goal is to use a placeholder, and during runtime add user controls to the placeholder as the items in the datagrid...
0
by: shark | last post by:
I have a placeholder in a control that is in turn, used as a control in a placeholder in a form. I am getting a viewstate error so I believe I have to clear my placeholder before I load the...
1
by: Angel | last post by:
I have added controls to the placeholder control. All the controls that were added have EnableViewState = true including the placeholder. One of the controls has a button that performs a postback. My...
6
by: David Colliver | last post by:
Hi, using vb.net 1.1 I am trying to add a control to a placeholder but am having problems with it. I do it practically the same way as i do in C# (I have more C# skill than VB.NET)and I...
7
by: Brad Baker | last post by:
I am trying to programmatically set a placeholder control in csharp which is nested inside a repeater control between <ItemTemplateand </ItemTemplate> tags, however I am running into problems. I've...
0
by: F | last post by:
Hi, The funniest part of the problem described here is that I am not new to ASP.NET, but honestly here I have no idea about what's going on. I have a GridView with a data source that just...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.