ASP.NET allows you to use the code render blocks (a la classic ASP) in the HTML output as long as its not embedded inside a runat=server'd tag. The only downside to this is that there's no way to control the viewstate of this code, so the code will be processed with each page postback no matter what.
On the other hand, if you used a procedure and built the html as a string and then assigned that string to a LITERAL control's .text field, you gain the option of preserving that output in the viewstate so that if the page posts back, you don't have to re-run that procedure. M. -----Original Message----- From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of PogoWolf Sent: Wednesday, April 20, 2005 11:14 PM To: [email protected] Subject: Re: [ASP] Code blocks are not supported in this context. (ASP.NET ) I would.. I did get it to work the the code block, and an IF..THEN (ye Olde ASP trick) but I'm not sure about the panel thing. On 4/20/05, Mark E <[EMAIL PROTECTED]> wrote: > You don't have to. Use Panels. They will do exactly what you want. > > Move your if statements to your code behind page, evaluate the > variable and show or hide the appropriate panel based on the out come. > > Let me know if you need more details. > > Mark > --- PogoWolf <[EMAIL PROTECTED]> wrote: > > > > in addition to the last post.. > > if it was JUST this line, making it a literal > > wouldn't be a problem. The > > issue is the '2nd' IF..THEN has about 75 lines of HTML to hide if > > the condition is false.. > > I'm not looking forward to hacking that HTML into bunch of > > response.writes. > > > > > > _____ > > > > From: [email protected] > > [mailto:[EMAIL PROTECTED] On Behalf Of Adrian > > Forbes - ITD > > Sent: Wednesday, April 20, 2005 6:12 AM > > To: [email protected] > > Subject: RE: [ASP] Code blocks are not supported in this context. > > (ASP.NET ) > > > > > > > Line 51 - 57 > > > <% > > > IF LEN(ColumnCheck) = 0 THEN > > > Response.Write ("<TD style='WIDTH: 50%;'>") ELSE > > > Response.Write("<TD>") > > > END IF > > > %> > > > > Don't think you can inject code like that in asp.net the way you > > could in asp. You need to place a server control there and on the > > page load event have your code update the content. Something like > > > > <asp:Literal ID="MyTD" runat="server"/> > > > > Then in the Page_onLoad event; > > > > If len(ColumnCheck) = 0 then > > MyTD.Text = "<TD style='WIDTH: 50%;'>" > > Else > > MyTD.Text = "<td>" > > End if > > > > Something like that anyway, unless someone can think of something > > better. > > > > > > The contents of this email and any attachments are sent for the > > personal attention of the addressee(s) only and may be confidential. > > If you are not the > > intended > > addressee, any use, disclosure or copying of this email and any > > attachments is unauthorised - please notify the sender by return and > > delete the message. > > Any > > representations or commitments expressed in this email are subject > > to contract. > > > > ntl Group Limited > > > > > > > > > --------------------------------------------------------------------- > > > > Home : > > http://groups.yahoo.com/group/active-server-pages > > > --------------------------------------------------------------------- > > Post : [email protected] > > Subscribe : > > [EMAIL PROTECTED] > > Unsubscribe: > > [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > > > > > > > > > > _____ > > > > Yahoo! Groups Links > > > > > > * To visit your group on the web, go to: > > http://groups.yahoo.com/group/active-server-pages/ > > > > > > * To unsubscribe from this group, send an email to: > > [EMAIL PROTECTED] > > > <mailto:[EMAIL PROTECTED] > cribe> > > > > > > > > * Your use of Yahoo! Groups is subject to the Yahoo! > > Terms of Service > > <http://docs.yahoo.com/info/terms/> . > > > > > > > > > > [Non-text portions of this message have been removed] > > > > > > > > > > > > > --------------------------------------------------------------------- > > Home : > http://groups.yahoo.com/group/active-server-pages > --------------------------------------------------------------------- > Post : [email protected] > Subscribe : [EMAIL PROTECTED] > Unsubscribe: > [EMAIL PROTECTED] > --------------------------------------------------------------------- > > > ________________________________ > Yahoo! Groups Links > > To visit your group on the web, go to: > http://groups.yahoo.com/group/active-server-pages/ > > To unsubscribe from this group, send an email to: > [EMAIL PROTECTED] > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. -- ---===/// The PogoWolf \\\===--- Amateurs built the ark, Professionals built the Titanic... BLOG: http://pogowolf.blogspot.com Xbox: Http://groups.yahoo.com/group/Xbox --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links --------------------------------------------------------------------- Home : http://groups.yahoo.com/group/active-server-pages --------------------------------------------------------------------- Post : [email protected] Subscribe : [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] --------------------------------------------------------------------- Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/active-server-pages/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
