Results 1 to 4 of 4

Thread: mixxing <% %> & <html></htmL>

  1. #1

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267

    Red face mixxing <% %> & <html></htmL>

    Since reading the thread about REsponse.Write I've been wondering about something I do from time to time and what the .net view of it would be.

    What I do is I make 4 or 5 UserControls lets say new.ascx, edit.ascx, delete.ascx, view.ascx and action_results.ascx. I also have an asp.net page called default.aspx in the app dir for this app. Now default.aspx has a select/switch statement that reads the QueryString for takeAction and display the correct ascx based on action. The only way I know to do this is by using:
    Code:
    <%
    switch(Request["takeAction"])
    {
        case "action": %><asp_uctls:ctl...../><% break;
        case "....":.....
    }
    %>

    So is that good, bad, is there a better way, will asp.net read the tag properly if I Response.Write it from the CodeBehind Class, or is all this just nitpicky?
    Magiaus

    If I helped give me some points.

  2. #2

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    Magiaus

    If I helped give me some points.

  3. #3
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    That'd be one case in which I'd use it. Generally, 90% of the time there's an equivalent way of writing code-behind code which does the same thing as using <% %>, but there are the odd times, as above where you just have to use them, this is one of those times I think!

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  4. #4

    Thread Starter
    Frenzied Member Magiaus's Avatar
    Join Date
    Mar 2002
    Location
    swamp land
    Posts
    1,267
    LoadControl("userControl.ascx")

    load an asp.net usercontrol onto a page. Since I haven't tried it yet I don't know where it loads it, but this could be the right way to do this
    Magiaus

    If I helped give me some points.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width