vb.net - Optimising asp.net vb code behind -


I have the code below. I'm getting a way to customize it.

Is it anyway optimized for using Findcontrol and Loops ?? Also, eliminating headoffice, choosing the selected area, selecting headoffice and using only the store?

  if (selected from store = 1) then tempCollector = tempCollector + "
+ "Section" + ":" + txt_panview3_ddinput1.SelectedItem.ToString tempCollector = tempCollector + "
" + "Store" + ":" + txt_panview3_input2.Text + "& lt; br & gt;" If the end (if field selected = 1) then tempCollector = tempCollector + "& lt; br & gt;" + "Area Name" + ":" + txt_panview0_ddinput1 Ending the selected item.ToString if (headoffice selected = 1) then tempCollector = tempCollector + "& lt; br & gt;" + "Section" + ":" + txt_panview1_ddinput1. Ending the selected item.ToString if if (field selected = 1) then tempCollector = tempCollector + "
+ "Area" + ":" + txt_panview2_ddinput1 If selected, select the item.ToString if 'from the store () = 0 then tempCollector = tempCollector + "

B & gt;" + Lbl_viewTitle2.Text + "& lt; / b & gt;" TempCollector = tempCollector + "& lt; br & gt;" + Lbl_view2_ManagersEmailAddress.Text + ":" + + txt_view2_ManagersEmailAddress.Text End If

you know To change all string concensations using stringbirders - it is very likely that it will be faster.

For most codes, you are repeating the same thing so that you can replace the repeated code with a sub method which if you call repeatedly do not see anything like [unnecessary]: < / P>

  Zero AddControlText (stringbuilder builder, string label, string value) {builder.Append ("
"); Builder.Append (label); Builder.Append (value); }

Edit:

At the moment it is a beginning, you will use the above method and will call it like this:

  stringbirder _Builder = new StringBuilder (); If (store selected = 1) then {AddControlText (_Builder, "department:", txt_panview3_ddinput1.SelectedItem.ToString); AddControlText (_Builder, "Store:", txt_panview3_input2.Text); }  

Edit (2): Really realized that you are using VB - and above is C # - hopefully you can translate it back to VB!


Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -