Render controls from ".txt" file into ASPX page

  • Thread starter Ahmed M. El-Moghazy
  • Start date
A

Ahmed M. El-Moghazy

Hi,
I have a text file "Controls_Page.txr" contains the
following:

<asp:Label id="Label1" style="Z-INDEX: 103; LEFT: 32px;
POSITION: absolute; TOP: 28px" runat="server"
Width="100px" Height="15px">Conn. String:</asp:Label>
<asp:TextBox id="TextBox1" style="Z-INDEX: 100; LEFT:
133px; POSITION: absolute; TOP: 25px" runat="server"
Width="344px" Height="22px"></asp:TextBox>

In my ASPX page in Page_Load event, I open the above file
and read line by line and use Response.write the read
line,
When I run the page I can't see any controls, when I
choose to view source in the browser I get this:
<asp:Label id="Label1" style="Z-INDEX: 103; LEFT: 32px;
POSITION: absolute; TOP: 28px" runat="server"
Width="100px" Height="15px">Conn. String:</asp:Label>
<asp:TextBox id="TextBox1" style="Z-INDEX: 100; LEFT:
133px; POSITION: absolute; TOP: 25px" runat="server"
Width="344px" Height="22px"></asp:TextBox>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0
Transitional//EN">
<HTML>
<HEAD>
.............................................

What can I do to display the controls from txt files in
my page?

Regards,
Ahmed M. Elmoghazy
Senior Web Developer
 
S

Shaji

Hi,
Try to include the file as below:
<!-- #include File = "YourFileName.inc" -->

OR

create a Web User Control(.ascx)

HTH
 
C

Claudiu Tomescu

Teemu, what about the cases when using custom server controls? I get an
error message cause the compiler doesn't recognize the prefix for my control
(although this one is declared in @Page directive). Any ideas?

Regards,
Claudiu Tomescu
MCP, MCSD
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top