Solved

.NET file include from variable

Posted on 2004-10-21
3
154 Views
Last Modified: 2013-11-18
hi,

I have a problem.
I want to make a page that shows different content on extensions.
e.g.
when address is default.aspx it shows the main page
when address is default.aspx?do=register then it shows the registering form
etc..

in php and that was quite easy
if request("do") = "register" then
inc_filename = "register.inc.asp"
else
inc_filename = "main.inc.asp"
end if

in .net I found an article where it explains that You have to use
<%@ Register TagPrefix="controlname" TagName="tagname" Src="file.ascx" %>
tag and control in the body.. but in this case it's not possible to change the source..

looking forward to Your help and guidence

R.
0
Comment
Question by:reesus
3 Comments
 
LVL 8

Accepted Solution

by:
razo earned 125 total points
ID: 12368344
what u can do is have different user controls
and then load the usercontrol to the webform based on the request value
to add a control dynamically u can use a place holder
 Dim c1 As UserControl = LoadControl("controlname.ascx")
        c1.ID = "id"

      placeholder1.Controls.Add(c1)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa‚Ķ
This article covers the basics of the Sass, which is a CSS extension language. You will learn about variables, mixins, and nesting.
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question