Relentless
New Member
Hi, I just started exploring asp.net after years with asp. I've been looking for this solution everywhere but to no avail.<BR><BR>How can I put large chunks of HTML within a procedure or function without using endless lines of response.write()<BR><BR>If I try the following, it always returns an error:<BR><BR>Sub Display()<BR> %><BR> lots of HTML goes here..<BR> even more...<BR> <%<BR>End SubSubs, procedures or functions run on the server, HTML is on the client... you do need Response.Write()<BR><BR>Was there a way to do that in Classic ASP???yes, exactly the way I put it in the message. You could mix asp and HTML code seamlessly and quickly. So now you're saying if I want to output 200 lines of client code I need to put 200 response.writes? That would seem like a step backward in time and way inefficient. I'm sure there's a way to do it, just need to know howThat is what was sooo bad about classic asp - that you could mix asp with html. An advantage of asp.net is that you can completely seperate your asp code from the html code... using a code behind file. a good way to do what you want is to create a server control in the html part of the .aspx page... make it a label:<BR><BR><asp:label id="lblBlah" runat="server"/><BR><BR>Then in your code behind, you can create all your HTML in whatever function/proc you want... Have that function/proc return it as a string variable, then set the string variable into the lblBlah server control...<BR><BR>lblBlah.text = getHTMLStuff()<BR><BR>This will put whatever is returned into the text for the label.. Label controls are just span elements I think.When I was switching over I though it was a major step back as well, but you need to learn more about asp.net. There are usually alot better ways to do things other than just writing out the html. If you are pulling this information from a database then use a repeater, datalist, or datagrid and it is much much better than asp. You can still do all the things you did in asp in asp.net, the code above should actually work, but it is not the best way to do things.<BR>Yeah, I guess .NET is a totally different way of thinking, so I'll have to get used to it. Thanks everyone for your input on this question.