473,718 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2283
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><for m
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*@REpoMOweVE rpick.com> wrote in message
news:eH******** ******@TK2MSFTN GP10.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><for m
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
1600
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 controls/pages that resulted from this. On these projects the page design was done with designers who used pure HTML with an HTML editing tool outside of Visual Studio. The developers then created the empty pages/user controls, copied the HTML code...
2
5521
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 base classes. A base class includes this property (among others...;-)):
9
2088
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 embeb them into HTML? Once converting to JPEG, it is easier to programming in HTML (i.e., just add the image tag), load faster, and prevent the user from download the files? Do you think that's a good idea. thanks
9
6728
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 page, I want to grab a URL and parse /change the HTML and send it to the JSP page. I take the URL from the user in a textbox (not the
5
2801
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. What's the best way to store users/password except database tables? and to store html files?
2
1713
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 application. The html that the user creates is a survey or form made up of textbox's, radio buttons and drop downs. The form gets saved to a sql database which then can be viewed on the front end of the application. The way I do this is have a label...
19
1832
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 classic asp. I have also been using System.Web.UI.ICallbackEventHandler to send data to the server and back without using controls. What I want to know is the pros and cons of each. To me you never have quite the freedom using a control as you...
15
5273
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 show - text boxes, input boxes, buttons, hyperlinks ie the usual. The data is not obtained directly from a database.
1
2641
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 a Web Application Project". The issue is that standard ASP.NET controls that are embedded as child controls within the ContentTemplate of the Ajax Control Toolkit's TabContainer/TabPanel are no longer visible to the page (and result in compile...
0
8827
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8723
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9354
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9207
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9120
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6652
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5971
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3182
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2122
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.