473,396 Members | 2,039 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,396 software developers and data experts.

ParseControl()

Good morning. I am having a problem with the TemplateControl.ParseControl()
method. It does parse the string into a control; however, added attributes
are left out of the parsing and make it to the final HTML code. For
example:

ParseControl("<asp:button OnClick="Btn_Click" text='Click here!'
runat='server' />");

Becomes this HTML:

<input type="submit" OnClick="Btn_Click" />

I can somewhat see why this would happen, as onclick is an event of the
browser. However, I need ParseControl() to treat OnClick as the ASP.NET
event, not the browser's DOM. Any suggestions?
Nov 18 '05 #1
1 1908
You can always hook up the event manully through the event handler...

+++ Rick ---

--

Rick Strahl
West Wind Technologies
http://www.west-wind.com/
http://www.west-wind.com/webblog/
----------------------------------
Making waves on the Web
"Jeremy McPeak" <http://www.wdonline.com/contact.aspx> wrote in message
news:Oy**************@TK2MSFTNGP12.phx.gbl...
Good morning. I am having a problem with the TemplateControl.ParseControl() method. It does parse the string into a control; however, added attributes are left out of the parsing and make it to the final HTML code. For
example:

ParseControl("<asp:button OnClick="Btn_Click" text='Click here!'
runat='server' />");

Becomes this HTML:

<input type="submit" OnClick="Btn_Click" />

I can somewhat see why this would happen, as onclick is an event of the
browser. However, I need ParseControl() to treat OnClick as the ASP.NET
event, not the browser's DOM. Any suggestions?

Nov 18 '05 #2

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

Similar topics

0
by: Matthias Lohrer | last post by:
Hi, I'm playing around with the possibilities of Page.ParseControl. Thanks to Kirk Allen Evans I got my example running (Posting Juli, 17, "Re: Generating ASP.NET-Controls with XSLT...
0
by: Matthias Lohrer | last post by:
Hi, I want to add dynamically controls to my aspx-Page by using the Page.parseControl-method. Page_Load contains this code: str = "<asp:TextBox runat='server' id='txtEingabe'...
0
by: Chris Simeone | last post by:
Hello, I'm having problems with the ParseControl() method creating unexpected output which I think is preventing events from firing. My code is based on this MSDN article:...
2
by: Chris Simeone | last post by:
When I use ParseControl in a C# code behind to create a button... Control c3 = ParseControl("<asp:button id='Button3' text='Btn3' oncommand='OnButton' commandname='Btn' commandargument='b3'...
1
by: Jeremy McPeak | last post by:
I am playing around with ParseControl(), and I have a question. First here is the code I am using: Control MyButton1 = Page.ParseControl("<asp:button id='MyButton' text='Click here!'...
0
by: PB | last post by:
According to the documentation, ParseControl returns a parsed control from an input string. The documentation seems to assume that *one* control will be parsed from the string. My implementation...
0
by: Fox | last post by:
Greetings, How can i parse inline code? I have the following code: System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<asp:TextBox id=\"myControl\" runat=\"server\"...
0
by: Dave | last post by:
Hi, I have a very simple page where i am using Page.ParseControl to create a datagrid control. When i try to run the DataBind method i get various errors. The code for the datagrid is as...
1
by: Jordan S. | last post by:
Using .NET 3.5, I'm wondering how to get a control's specific type (e.g,. "Button" and not simply "Control") after the control is inserted into a control hierarchy - when ParseControl is used. ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.