webform performance
-
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!
-
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!
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.
-
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.
-
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.
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 StructurePublic 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 IntegerDim dwExitCode as Integer = 2 'Do Database Read return dwExitCode
End Function