473,396 Members | 1,995 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.

Converting HTML files to User Controls

Hello,

A partner is going to be creating some HTML files that I plan on converting
to user controls (UC) and dynamically load at runtime. I'm guessing Visual
Studio doesn't come with some utililty to convert HTML files to UCs? IOW,
I'll have to manually convert each HTML file to a UC? I've never used user
controls before, so I'm wondering what I need to add and remove to each UC
(or HTML file) to make this work. For instance, I suppose I will need to
add an ASP.NET page directive to each UC and remove the <HTML>, <HEAD> and
<BODY> tags from each UC? What else do I need to add/remove? Is the
content of each ASCX just consist of the HTML that will be inserted into a
host ASPX page?

Also, I plan on adding some ASP.NET server controls (Labels, Image controls,
etc.) to the UC. Do I need to add a <Form runat="server"> tag to the ASCX
file if I'm going to be doing this? Lastly, since I'll be loading one of
these UCs dynamically, what do I put in the host ASPX file where the UC will
be loaded ... a placeholder? Or is there a less generic control I can add
to the host ASPX file - something like <asp:Control>?

Many questions :) Any answers are appreciated!
Thanks/Ben
Nov 19 '05 #1
2 2269
Best thing to do would be to create a ASP.Net page, then create a new user
control and drop it on the page. It should give you some insight on what
you have to do.

There's no hard rule for what an uc contains, but you are right, typically
the enclosing page contains the <html><head>....</head><body><form
runat="server">...</form></body></html> and often times more. So you'll
likely not want that in your UC. Also the uc makes use of a @Control
directive, not @Page directive. As I said, you normally put the form
runat="Server" in the page, and put the user control within the form - that
way you can have multiple uc. Placeholders are good for storing controls.

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/
http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!

"Ben Amada" <be*@REpoMOweVErpick.com> wrote in message
news:eH**************@TK2MSFTNGP10.phx.gbl...
Hello,

A partner is going to be creating some HTML files that I plan on
converting to user controls (UC) and dynamically load at runtime. I'm
guessing Visual Studio doesn't come with some utililty to convert HTML
files to UCs? IOW, I'll have to manually convert each HTML file to a UC?
I've never used user controls before, so I'm wondering what I need to add
and remove to each UC (or HTML file) to make this work. For instance, I
suppose I will need to add an ASP.NET page directive to each UC and remove
the <HTML>, <HEAD> and <BODY> tags from each UC? What else do I need to
add/remove? Is the content of each ASCX just consist of the HTML that
will be inserted into a host ASPX page?

Also, I plan on adding some ASP.NET server controls (Labels, Image
controls, etc.) to the UC. Do I need to add a <Form runat="server"> tag
to the ASCX file if I'm going to be doing this? Lastly, since I'll be
loading one of these UCs dynamically, what do I put in the host ASPX file
where the UC will be loaded ... a placeholder? Or is there a less generic
control I can add to the host ASPX file - something like <asp:Control>?

Many questions :) Any answers are appreciated!
Thanks/Ben

Nov 19 '05 #2
Karl Seguin wrote:
Best thing to do would be to create a ASP.Net page, then create a new user
control and drop it on the page. It should give you some insight on what
you have to do.

There's no hard rule for what an uc contains, but you are right, typically
the enclosing page contains the <html><head>....</head><body><form
runat="server">...</form></body></html> and often times more. So you'll
likely not want that in your UC. Also the uc makes use of a @Control
directive, not @Page directive. As I said, you normally put the form
runat="Server" in the page, and put the user control within the form -
that way you can have multiple uc. Placeholders are good for storing
controls.
Karl


Hi Karl,

Thanks for addressing my questions. As you suggest, I'll go ahead and
create a new web form, add a user control to it and see what code VS
generates.

Regards,
Ben
Nov 19 '05 #3

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

Similar topics

1
by: E. Tom Jorgenson | last post by:
I've run into a problem on a couple of projects that I think I've identified - but would like confirmation of what I think is going on. Also interested in any fast solutions to fix the user...
2
by: Fredrik Rodin | last post by:
All, I'm having problems with my resource manager in ASP.NET 2.0 after conversion from ASP.NET 1.1. Here is a background: In ASP.NET 1.1 All my user controls and aspx pages inherit from...
9
by: Tim | last post by:
Since rtf files cause so many troubles, i.e., allow the users to download the files, slow loading, incompatible with other browser, and so on. Do you think I should convert them to JPEG files to...
9
by: anupamjain | last post by:
Hi, After 2 weeks of search/hit-and-trial I finally thought to revert to the group to find solution to my problem.(something I should have done much earlier) This is the deal : On a JSP...
5
by: nick | last post by:
I need to create a simple asp.net application that use password protect some html pages. The html page provider doesn't know asp.net. And the host doesn't allow me to create user accounts. ...
2
by: robert112 | last post by:
This is quite a hard one guys. ***Some necessary back ground Info*** I have an asp.net 1.1 application that uses a WYSIWYG to return some html created by the user in the admin section of the...
19
by: ThatsIT.net.au | last post by:
I come from a classic asp background, but have started using ASP.NET about 12 months ago, but I'm still not sure about the pros and cons of using controls v HTML spat out from code as you would in...
15
by: lxyone | last post by:
Using a flat file containing table names, fields, values whats the best way of creating html pages? I want control over the html pages ie 1. layout 2. what data to show 3. what controls to...
1
by: =?Utf-8?B?SG93YXJkIFBpbnNsZXk=?= | last post by:
I'm trying to convert a Web Site to the Web Application project model and I'm running into compile errors that do not seem to be covered by the guidance I found at "Converting a Web Site Project to...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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
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.