Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ASP.NET inline code - architectural question

ASP.NET inline code - architectural question

Scheduled Pinned Locked Moved ASP.NET
questioncsharpasp-net
10 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    Gennady Oster
    wrote on last edited by
    #1

    Hi to all ! I'd like to understand, where in the resulting ..._aspx class goes inline code, found on the page inside code brackets. I want to create the dynamic page, where the existence of controls is managed by parameters, say, from querystring. Is the following the best way to do it: <% if (Request.QueryString.Get("par")=="2"){ %> <% } %> Or I have to get rid of designer and create the page programmaticaly in whole? Thanks in advance. Regards, Gennady

    K J 2 Replies Last reply
    0
    • G Gennady Oster

      Hi to all ! I'd like to understand, where in the resulting ..._aspx class goes inline code, found on the page inside code brackets. I want to create the dynamic page, where the existence of controls is managed by parameters, say, from querystring. Is the following the best way to do it: <% if (Request.QueryString.Get("par")=="2"){ %> <% } %> Or I have to get rid of designer and create the page programmaticaly in whole? Thanks in advance. Regards, Gennady

      K Offline
      K Offline
      kubben
      wrote on last edited by
      #2

      You could do it that way, but I would suggest looking at the Placeholder control and something to use to hide or show your controls. On you page load even you can check the query string and show or hide the correct placeholders that have the controls in them. Hope that helps. Ben

      G 1 Reply Last reply
      0
      • K kubben

        You could do it that way, but I would suggest looking at the Placeholder control and something to use to hide or show your controls. On you page load even you can check the query string and show or hide the correct placeholders that have the controls in them. Hope that helps. Ben

        G Offline
        G Offline
        Gennady Oster
        wrote on last edited by
        #3

        Hi ! Thank you for your reply. I'll look at this control (I'm new enough in ASP.NET). But my question was not exactly "how to do", but rather "how it works". The thing is that I have to create the new .NET version of the existing site that is on high demand (about a million visitors per month). So performance is THE issue. I'd like not to squander resources on creating hidden controls and emitting the javascript code that will never work. That's why I'm trying to understand what is going on under the hood. Thanks once more. Regards, Gennady

        K 1 Reply Last reply
        0
        • G Gennady Oster

          Hi ! Thank you for your reply. I'll look at this control (I'm new enough in ASP.NET). But my question was not exactly "how to do", but rather "how it works". The thing is that I have to create the new .NET version of the existing site that is on high demand (about a million visitors per month). So performance is THE issue. I'd like not to squander resources on creating hidden controls and emitting the javascript code that will never work. That's why I'm trying to understand what is going on under the hood. Thanks once more. Regards, Gennady

          K Offline
          K Offline
          kubben
          wrote on last edited by
          #4

          With the placeholder control, when it is set to false, that html is not rendered in the page. I don't think you would see any performance issue. The code that you had for your example could have some performace issues since it is parsed. Ben

          G 1 Reply Last reply
          0
          • G Gennady Oster

            Hi to all ! I'd like to understand, where in the resulting ..._aspx class goes inline code, found on the page inside code brackets. I want to create the dynamic page, where the existence of controls is managed by parameters, say, from querystring. Is the following the best way to do it: <% if (Request.QueryString.Get("par")=="2"){ %> <% } %> Or I have to get rid of designer and create the page programmaticaly in whole? Thanks in advance. Regards, Gennady

            J Offline
            J Offline
            Justin Bozonier
            wrote on last edited by
            #5

            For your simple example panels would be good. If you're doing anything really complex though you could take a look at an article I wrote about handling views here: http://www.codeproject.com/useritems/ViewManagerTutorial.asp Just one more option. I'm honestly not sure how much of a performance impact this would have versus panels. Because of the simplicity of the class though I would have to lean towards that it may be a leaner solution. If anyone has any discrete data to the contrary please correct me! -Justin

            G 1 Reply Last reply
            0
            • K kubben

              With the placeholder control, when it is set to false, that html is not rendered in the page. I don't think you would see any performance issue. The code that you had for your example could have some performace issues since it is parsed. Ben

              G Offline
              G Offline
              Gennady Oster
              wrote on last edited by
              #6

              Hi ! So, if I've understand right, the inline code goes to the Render method of the resulting class? As for Placeholder control, I have to learn it in comparison to Panel or simply adding controls to the page collection in the Load event handler. From the glance I cannot see great difference between these three options for my case. May be in the event propagation model? Thanks. Regards, Gennady

              K 1 Reply Last reply
              0
              • J Justin Bozonier

                For your simple example panels would be good. If you're doing anything really complex though you could take a look at an article I wrote about handling views here: http://www.codeproject.com/useritems/ViewManagerTutorial.asp Just one more option. I'm honestly not sure how much of a performance impact this would have versus panels. Because of the simplicity of the class though I would have to lean towards that it may be a leaner solution. If anyone has any discrete data to the contrary please correct me! -Justin

                G Offline
                G Offline
                Gennady Oster
                wrote on last edited by
                #7

                Hi ! Thank your for reply. Concerning viewmanager, and also multiview and view controls - suppose I can use them, say, to implement the tabs. But not in the case in question. I think, it's not a good idea - generate 100 views per user request to always show him only one. Or I didn't understand something? To understand what type of site I mean - two links to the same site: emap/English[^] gj[^] Thanks. Regards, Gennady

                J 1 Reply Last reply
                0
                • G Gennady Oster

                  Hi ! Thank your for reply. Concerning viewmanager, and also multiview and view controls - suppose I can use them, say, to implement the tabs. But not in the case in question. I think, it's not a good idea - generate 100 views per user request to always show him only one. Or I didn't understand something? To understand what type of site I mean - two links to the same site: emap/English[^] gj[^] Thanks. Regards, Gennady

                  J Offline
                  J Offline
                  Justin Bozonier
                  wrote on last edited by
                  #8

                  Ahh I see what you're going for. Honestly in that situation I would use the view manager. The reason for that is that the purpose of the class is always to show just one view. The ViewManager only stores references to the controls which I believe should be pretty inexpensive and the time it would take to initialize it should be trivial. Also when you have such a complicated view it seems like it would be nice to be able to initialize it with a single call. -Justin

                  1 Reply Last reply
                  0
                  • G Gennady Oster

                    Hi ! So, if I've understand right, the inline code goes to the Render method of the resulting class? As for Placeholder control, I have to learn it in comparison to Panel or simply adding controls to the page collection in the Load event handler. From the glance I cannot see great difference between these three options for my case. May be in the event propagation model? Thanks. Regards, Gennady

                    K Offline
                    K Offline
                    kubben
                    wrote on last edited by
                    #9

                    I don't think that is true. The panel and the placeholder control are similar. The difference is that the panel control can still take up some space in the html. The placeholder control will not. The example code you used has the <% these tags are parsed later and take more time. Since speed is a concern I think you would be much better off using the placeholder control. Ben

                    G 1 Reply Last reply
                    0
                    • K kubben

                      I don't think that is true. The panel and the placeholder control are similar. The difference is that the panel control can still take up some space in the html. The placeholder control will not. The example code you used has the <% these tags are parsed later and take more time. Since speed is a concern I think you would be much better off using the placeholder control. Ben

                      G Offline
                      G Offline
                      Gennady Oster
                      wrote on last edited by
                      #10

                      kubben wrote:

                      these tags are parsed later and take more time

                      Thanks, Ben ! This is exactly what I'd like to understand - when and where. But think, even the placeholder will not be a good alternative. More I think about it - more I incline to the idea, that the best decision in my case would be to write the kind of page generator, that will create "static" aspx pages (about 100) on the base of page template and type definitions from the DB. This has to provide the performance benefit, yet supporting the desired level of flexibility and managability. I hope ... Thanks. Regards, Gennady

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups