Last post Dec 14, 2010 05:41 AM by rezaxp
Dec 10, 2010 02:38 PM|Jerry8989|LINK
I have a piece of code that is just HTML. It was previously created as a user control. Within the application i'm working with there are two seperate websites that are interlinked to make one website. There is a documents section where users do not need
to login and a data section where users need to login. The design was implemented long before I was hired. My problem is I want to use the code from the documents website with the data website but I can't seem to register the control. I only one this piece
of code in one place so when it is updated it doesn't have to be in multiple places. I tried setting "src=http://website/doc/doc.ascx" but this errors out saying
<%@ Register Src="http://website/doc/doc.ascx" TagName="docs" TagPrefix="temp" %>
Parser Error Message:
The file '/documents/http://website/doc/doc.ascx' does not exist.
It adds the directory as part of the src. How can I have it point to this location http://website/doc/doc.ascx ?
Register User Control
Dec 10, 2010 04:28 PM|rezaxp|LINK
As I know you cant do it.the url should be relative because the url will be translate to a physical path for reading the ascx file content I think it's not possible
Dec 13, 2010 08:53 AM|Jerry8989|LINK
What would be the cleanest way to use a piece of html code across two websites?
Dec 13, 2010 09:13 AM|rezaxp|LINK
you can use one of thease ways
1.copy the ascx in your project
2.put an Iframe and load the usercontrol from the orginal application if its possible to direct load ascx
3.grab the compiled html by requesting the orginal site url and finding the piece you want in the html
but I think it's better to keep the ascx in your own application .this will prohobit any issue if the orginal application change the ascx
Dec 13, 2010 10:08 AM|Jerry8989|LINK
It's only a piece of html I don't have to have it in an ascx file. Is there a way to use an include and just have my html code in that html file?
My code is only a table so I just need to include that html table code on two different sites. Is there some type of include i could use?
For the site where the html file is located I could use "/data/test.html" and for the other site I could use "http://www.temp.com/data/test.html" is this possible?
It seems like the easiest thing to figure out but I haven't been able too. It's about 100 lines of html that is just a table.
Thanks again for the help
Dec 13, 2010 08:58 PM|rezaxp|LINK
why you don't use Iframe tag???
see : http://www.w3schools.com/tags/tag_iframe.asp
Dec 14, 2010 02:15 AM|Qin Dian Tang - MSFT|LINK
Here are two articles about how to reuse user control:
Dec 14, 2010 05:41 AM|rezaxp|LINK
Thanks Qin Dian that was windeful , I didn't know this feature.