Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making an object with response.write("")

Status
Not open for further replies.

shad0wchaser

Programmer
Feb 8, 2005
1
NL
Hi guys, i have a problem here with my newsletter application

I am trying to make a dynamic page with
Response.write("<html> codes")
and making textarea with loops and giving them ids and names also in loops.
for example

Dim cntL as integer
for cntL = 1 to 10
Response.Write(" <tr>")
Response.Write("<td><img id=imgLvL" & cntL & " src=../nieuwsbrieven2/img/pubnr.bmp border=0 />")
Response.Write("<input name=txtLvL" & cntL & " type=text id=txtLvL" & cntL & " style=height:24px;width:216px; /></td>")
Response.Write(" </tr>")

next


I am trying to declare a textarea generated from that loop with the name lvl1, for example:

Dim lvl1 As String = txtLvL1.Text.Replace(Chr(13), "<br>")

but of course it makes an error with visual basic because txtLvL1 is not declared.

If any of you experts know how to deal with declaring objects that are made with response.write() would be kind to share with me.

Thank you
 
You are going against the whole principle of .NET by using Response.Write and trying to create controls this way!

ASP.NET allows you to create controls server side. e.g.
Code:
Dim lblHeader As Label
lblHeader.BackColor = Color.Transparent
lblHeader.ForeColor = Color.Navy
lblHeader.Text = "Header Label"
MyPanel.Controls.Add(lblHeader)

You can also add event handlers to these controls if necessary to handle click events etc.

I really think that you will need to have a read of some of the basic articles on ASP.NET as using Response.Write to create your whole page is a definate no-no and not what ASP.NET was designed for.

Have a look at some of the articles on as this will provide a good starting point.


----------------------------------------------------------------------

Need help finding an answer?

Try the search facilty ( or read FAQ222-2244 on how to get better results.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top