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. webform performance

webform performance

Scheduled Pinned Locked Moved ASP.NET
questionperformance
4 Posts 2 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
    gaigoi113
    wrote on last edited by
    #1

    I have about 10 sets list of values tables that I need to bind to a dropdownlist on the webform. My question is when should I do databinding to get better performance? I have tried at: OnInit() and Page_Load() but still seeing the slowness. Any suggestions? - Thank you in advance!

    J 1 Reply Last reply
    0
    • G gaigoi113

      I have about 10 sets list of values tables that I need to bind to a dropdownlist on the webform. My question is when should I do databinding to get better performance? I have tried at: OnInit() and Page_Load() but still seeing the slowness. Any suggestions? - Thank you in advance!

      J Offline
      J Offline
      jkirkerx
      wrote on last edited by
      #2

      In my opinion, the page.load cycle. Page.Init is for creating controls or HTML elements, creating the framework or structure of the web page. Page.Load is for loading data into the framework, or HTML elements. As far as the slowness goes, binding to a control is just plain slow. You can write more efficient code to populate a dropdown box, that would be much faster in operation.

      G 1 Reply Last reply
      0
      • J jkirkerx

        In my opinion, the page.load cycle. Page.Init is for creating controls or HTML elements, creating the framework or structure of the web page. Page.Load is for loading data into the framework, or HTML elements. As far as the slowness goes, binding to a control is just plain slow. You can write more efficient code to populate a dropdown box, that would be much faster in operation.

        G Offline
        G Offline
        gaigoi113
        wrote on last edited by
        #3

        Thank you jkirkerx! That's help save me a few bucks. I was gonna go buy redgate ants to figure out where the bottleneck at.

        J 1 Reply Last reply
        0
        • G gaigoi113

          Thank you jkirkerx! That's help save me a few bucks. I was gonna go buy redgate ants to figure out where the bottleneck at.

          J Offline
          J Offline
          jkirkerx
          wrote on last edited by
          #4

          Your Welcome That's a popular question, I use to bind years ago, but overall in the end, the bindings have to be recreated if you move your project to another server or something. And it was so slow, because the binding code has to be created every time it's used. So you create a function to load the data, and package the data in a class or structure, and loop through the class or structure records. Something like below code, that's just off the top of my head in vb, but you should get the idea.

          Public Structure structure_States
          Public p_StateName as string
          Public p_StateAbbr as string
          End Structure

          Public Sub load_States()

           ddl\_StateNames\_Field.Items.Clear
           Dim p\_stateCount as Integer = get\_StateNames\_Count()
           Dim sSn(p\_stateCount) as structure\_States
           Dim dwExitCode as Integer = load\_StateNames(sSn)
           
           if (0 = dwExitCode) then
            For idx as Integer = 0 to sSn.length - 1
                ddl\_StateNames.Item.add(new ListItem(sSn(idx).p\_StateName, sSn(idx).p\_stateAbbr))
            Next
          end if
          

          end Sub
          Public Function load_StateNames(ByRef s_StateNames() as structure_States) As Integer

           Dim dwExitCode as Integer = 2
           'Do Database Read
          
           return dwExitCode
          

          End Function

          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