Hello,
I have a senario in which closing an edit form is taking an unacceptable amount of time. It takes an average of 4 seconds to open the form and over 30 seconds to close the form. Does anyone have any suggestions to why this would be the case?
Here is the markup:
and the code behind:
It seems like performance gets a lot worse when the method getControls() is initally called which does not make sense becuase it is not called upon closing the form.
Any hints or tips would be greatly appreciated.
Thanks,
Casey
I have a senario in which closing an edit form is taking an unacceptable amount of time. It takes an average of 4 seconds to open the form and over 30 seconds to close the form. Does anyone have any suggestions to why this would be the case?
Here is the markup:
<telerik:RadGrid ID="RadGrid1" runat="server" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowMultiRowSelection="True" AllowSorting="True" AllowFilteringByColumn="true" AutoGenerateColumns="False" CellSpacing="0" GridLines="None" GroupingEnabled="False" PageSize="20" Skin="Web20"> <clientsettings> </clientsettings> <headercontextmenu cssclass="GridContextMenu GridContextMenu_Default"></headercontextmenu> <PagerStyle AlwaysVisible="True" Mode="NextPrevAndNumeric" /> <mastertableview allowautomaticinserts="True" DataKeyNames="UPC_Num" allowmulticolumnsorting="True" commanditemdisplay="Top" insertitempageindexaction="ShowItemOnFirstPage" NoMasterRecordsText="No UPCs Exist for this Product"> <CommandItemSettings ExportToPdfText="Export to PDF" /> <rowindicatorcolumn filtercontrolalttext="Filter RowIndicator column"></rowindicatorcolumn> <expandcollapsecolumn filtercontrolalttext="Filter ExpandColumn column"></expandcollapsecolumn> <Columns> <telerik:GridEditCommandColumn FilterControlAltText="Filter EditCommandColumn column" UpdateText="Edit"></telerik:GridEditCommandColumn> <telerik:GridTemplateColumn UniqueName="cbSelect" AllowFiltering="false"> <HeaderTemplate> <asp:CheckBox id="headerChkbox" OnCheckedChanged="ToggleSelectedState" AutoPostBack="True" runat="server"></asp:CheckBox> </HeaderTemplate> <ItemTemplate> <asp:CheckBox id="CheckBox1" runat="server"></asp:CheckBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn runat="server" DataField="UPC_Num" FilterControlAltText="Filter UPC_Num column" HeaderText="UPC #" UniqueName="UPC_Num"> </telerik:GridBoundColumn> <telerik:GridBoundColumn runat="server" DataField="UPC_Nme" FilterControlAltText="Filter UPC_Nme column" HeaderText="Name" UniqueName="UPC_Nme"> </telerik:GridBoundColumn> <telerik:GridDateTimeColumn runat="server" DataField="Start_Dte" DataFormatString="{0:M/dd/yyyy}" FilterControlAltText="Filter Start_Dte column" HeaderText="Start Date" MaxDate="2999-12-31" UniqueName="Start_Dte"> </telerik:GridDateTimeColumn> <telerik:GridBoundColumn runat="server" DataField="Active_Flg" FilterControlAltText="Filter Active_Flg column" HeaderText="Status" UniqueName="Active_Flg"> </telerik:GridBoundColumn> <telerik:GridDateTimeColumn runat="server" DataField="Modify_Dte" DataFormatString="{0:M/dd/yyyy}" FilterControlAltText="Filter Modify_Dte column" HeaderText="Date Modified" MaxDate="2999-12-31" UniqueName="Modify_Dte"> </telerik:GridDateTimeColumn> <telerik:GridBoundColumn runat="server" DataField="Logon_User" FilterControlAltText="Filter Logon_User column" HeaderText="Modified By" UniqueName="Logon_User"> </telerik:GridBoundColumn> <telerik:GridBoundColumn runat="server" DataField="Replenish_FG" FilterControlAltText="Filter Replenish_FG column" HeaderText="Replenish Flag" UniqueName="Replenish_FG"> </telerik:GridBoundColumn> <telerik:GridNumericColumn runat="server" DataField="Avail_Qty" DecimalDigits="2" FilterControlAltText="Filter Avail_Qty column" HeaderText="Inventory" UniqueName="Avail_Qty"> </telerik:GridNumericColumn> <telerik:GridBoundColumn runat="server" DataField="Drop_Ship_FLG" FilterControlAltText="Filter Drop_Ship_FLG column" HeaderText="DS Flag" UniqueName="Drop_Ship_FLG"> </telerik:GridBoundColumn> <telerik:GridBoundColumn runat="server" DataField="OVER_WEIGHT_FLG" FilterControlAltText="Filter OVER_WEIGHT_FLG column" HeaderText="Overweight Flag" UniqueName="OVER_WEIGHT_FLG"> </telerik:GridBoundColumn> <telerik:GridBoundColumn runat="server" DataField="Web_Exclusive_FLG" FilterControlAltText="Filter Web_Exclusive_FLG column" HeaderText="WE Flag" UniqueName="Web_Exclusive_FLG"> </telerik:GridBoundColumn> <telerik:GridBoundColumn runat="server" DataField="Reg_Count" FilterControlAltText="Filter Reg_Count column" HeaderText="# of Registries" UniqueName="Reg_Count"> </telerik:GridBoundColumn> <telerik:GridDateTimeColumn runat="server" DataField="End_Dte" DataFormatString="{0:M/dd/yyyy}" FilterControlAltText="Filter End_Dte column" HeaderText="End Date" MaxDate="9999-12-31" UniqueName="End_Dte" Visible="false"> </telerik:GridDateTimeColumn> </Columns> <editformsettings editformtype="Template"> <editcolumn filtercontrolalttext="Filter EditCommandColumn column" uniquename="EditCommandColumn1"></editcolumn> <formtemplate> <%--<uc3:cntUPCMaint ID="cntUPCMaint1" runat="server" />--%> <table id="Table1" cellspacing="1" cellpadding="0" width="900" border="0"> <tr> <td colspan="4"><asp:label id="UMlblError" runat="server" CssClass="ErrorMessage"></asp:label></td> </tr> <tr> <td colspan="4"><asp:label id="lblPageTitle" runat="server"></asp:label></td> </tr> <tr> <td style="WIDTH: 565px" colspan="2"><asp:label id="Label1" runat="server" CssClass="title" Visible="False">UPC Attributes:</asp:label></td> <td></td> <td align="right"></td> </tr> <tr> <td style="WIDTH: 281px"> <asp:Label ID="Label18" runat="server" CssClass="ContentLabel" Text="Start Date:"> </asp:Label> <telerik:RadDatePicker ID="dtStartDate" Runat="server" MaxDate="9999-12-31" MinDate="" Skin="Web20"> <Calendar Runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x" Skin="Web20"></Calendar> <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton> <DateInput Runat="server" DisplayDateFormat="MM/dd/yyyy" DateFormat="MM/dd/yyyy"></DateInput> </telerik:RadDatePicker> </td> <td style="WIDTH: 425px"> <asp:Label ID="Label19" runat="server" CssClass="ContentLabel" Text="End Date:"></asp:Label> <telerik:RadDatePicker ID="dtEndDate" Runat="server" MaxDate="9999-12-31" MinDate="" Skin="Web20"> <Calendar Runat="server" UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x" Skin="Web20"></Calendar> <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton> <DateInput Runat="server" DisplayDateFormat="MM/dd/yyyy" DateFormat="MM/dd/yyyy"></DateInput> </telerik:RadDatePicker> </td> <td class="contentLabel"><asp:label id="Label14" runat="server" ToolTip="Rules for changing UPC status: Can not change Ready to Pending; Inactive can only be changed to Deleted; Everything else is ok ">Status:</asp:label> <asp:DropDownList ID="ddlUPCStatus" runat="server"> <asp:ListItem Value="P">Pending</asp:ListItem> <asp:ListItem Value="R">Ready</asp:ListItem> <asp:ListItem Value="A">Active</asp:ListItem> <asp:ListItem Value="I">Inactive</asp:ListItem> <asp:ListItem Value="D">Delete</asp:ListItem> </asp:DropDownList> </td> <td> </td> </tr> </table> <TABLE id="Table2" cellSpacing="1" cellPadding="0" width="900" border="0"> <tr> <td vAlign="top" class="style1"><asp:label id="Label2" runat="server" CssClass="contentlabel" Visible="False">Web Description:</asp:label></td> <td vAlign="top" class="style1"> </td> <td style="WIDTH: 429px" colSpan="2" vAlign="top"> <asp:Label id="txtWebDesc" runat="server" CssClass="title" Width="416px" Height="56px" Visible="False">Label</asp:Label></td> <td> </td> </tr> <tr> <td class="style1"><asp:label id="Label4" runat="server" CssClass="ContentLabel">Weight</asp:label></td> <td class="style1"> </td> <td style="WIDTH: 429px" colSpan="2"><asp:textbox id="txtWeight" runat="server"></asp:textbox></td> <td><asp:label id="LabelUPC11" runat="server" CssClass="title" Visible="False">Mainframe Values:</asp:label></td> </tr> <tr> <td class="style1"><asp:label id="Label5" runat="server" CssClass="contentlabel">Overweight: </asp:label><asp:checkbox id="chkOverweight" runat="server" CssClass="contentlabel"></asp:checkbox> <asp:RadioButtonList ID="rblOverweight" runat="server" CssClass="ContentLabel"> <asp:ListItem>Set to Overweight</asp:ListItem> <asp:ListItem>Reset Overweight</asp:ListItem> </asp:RadioButtonList> </td> <td class="style1"> </td> <td style="WIDTH: 429px" colSpan="2"><asp:label id="Label6" runat="server" CssClass="contentlabel" Visible="False">Overweight Cost</asp:label> <asp:textbox id="txtFatCost" runat="server" Visible="False"></asp:textbox></td> <td><asp:label id="lblSSNdc" runat="server" CssClass="contentLabel"></asp:label></td> </tr> <tr> <td class="style1"><asp:label id="Label7" runat="server" CssClass="contentlabel">Safety Stock Number</asp:label></td> <td class="style1"> </td> <td style="WIDTH: 429px" colSpan="2"><asp:textbox id="txtSafetyNum" runat="server"></asp:textbox></td> <td><asp:label id="lblColor" runat="server" CssClass="contentLabel"></asp:label></td> </tr> <tr> <td class="style1"><asp:label id="Label17" runat="server" CssClass="contentlabel">Special Handling Fee</asp:label></td> <td class="style1"> </td> <td style="WIDTH: 429px" colspan="2"><asp:textbox id="txtSHF" runat="server"></asp:textbox></td> <td><asp:label id="lblSize" runat="server" CssClass="contentLabel"></asp:label></td> </tr> <tr> <td class="style1"><asp:label id="Label9" runat="server" CssClass="contentlabel">Pre Order Date</asp:label></td> <td class="style1"> </td> <td style="WIDTH: 429px" colSpan="2"> <telerik:RadDatePicker ID="txtpreorderdt" Runat="server" MaxDate="2999-12-31" Skin="Web20"> <Calendar UseRowHeadersAsSelectors="False" UseColumnHeadersAsSelectors="False" ViewSelectorText="x" Skin="Web20"></Calendar> <DatePopupButton ImageUrl="" HoverImageUrl=""></DatePopupButton> <DateInput DisplayDateFormat="MM/dd/yyyy" DateFormat="MM/dd/yyyy"></DateInput> </telerik:RadDatePicker> </td> <td><asp:label id="lblColorFamily" runat="server" CssClass="contentLabel"></asp:label></td> </tr> <tr> <td class="style1"><asp:label id="Label10" runat="server" CssClass="contentlabel">Back Order Time Frame</asp:label></td> <td class="style1"> </td> <td style="WIDTH: 429px" colSpan="2"><asp:textbox id="txtBackOrder" runat="server"></asp:textbox></td> <td></td> </tr> <tr> <td class="style1"><asp:label id="Label12" runat="server" CssClass="contentlabel" ToolTip="Comment for the product goes here. This field will not display on the website.">Comment:</asp:label></td> <td class="style1"> </td> <td style="WIDTH: 429px" colSpan="2"><asp:textbox id="txtUPCComment" runat="server" Height="30px" Width="500px" TextMode="MultiLine"></asp:textbox></td> <td> </td> </tr> <tr> <td class="style1" ><asp:label id="Label13" runat="server" CssClass="contentlabel">Drop-Ship:</asp:label> <asp:checkbox id="chbDropShip" runat="server" CssClass="contentlabel"></asp:checkbox> <asp:RadioButtonList ID="rblDropShip" runat="server" CssClass="ContentLabel"> <asp:ListItem>Set to Drop-Ship</asp:ListItem> <asp:ListItem>Reset Drop-Ship</asp:ListItem> </asp:RadioButtonList> </td> <td class="style1" > </td> <td ><asp:label id="Label15" runat="server" CssClass="contentlabel">Web Exclusive:</asp:label> <asp:checkbox id="chbWebEx" runat="server" CssClass="contentlabel"></asp:checkbox> <asp:RadioButtonList ID="rblWebEx" runat="server" CssClass="ContentLabel"> <asp:ListItem>Set to Web Exclusive</asp:ListItem> <asp:ListItem>Reset Web Exclusive</asp:ListItem> </asp:RadioButtonList> </td> <td><asp:label id="Label16" runat="server" CssClass="contentLabel"></asp:label></td> </tr> <tr> <td class="style1"><asp:HyperLink ID="HyperLink1" CssClass="contentlabel" Font-Underline="true" ToolTip="Click on this link to see the list of Return Codes and their instructions." NavigateUrl="javascript:image_window=window.open('view_return_codes.aspx','image_window','width=700,height=400,left=323,top=195,scrollbars=yes');image_window.focus()" runat="server">Return Code:</asp:HyperLink></td> <td class="style1"> </td> <td style="WIDTH: 429px" colSpan="2"><asp:DropDownList ID="ddlRtnCodes" runat="server" CssClass="contentlabel"></asp:DropDownList> <td> </td> </tr> <tr> <td colSpan="5"><hr> </td> </tr> <tr> <td colSpan="5"> <%-- <uc1:cntattibuteoptiontypes ID="cntattibuteoptiontypes1" runat="server" />--%> <table class="style2"> <tr> <td nowrap="nowrap"> <asp:Label ID="lblOptionColor" runat="server" Visible="False" Text="Select a Color"></asp:Label> </td> <td> <asp:DropDownList ID="ddlOptionColor" runat="server" Visible="False"> </asp:DropDownList> </td> <td nowrap="nowrap"> <asp:Label ID="lblOptionColorAdd" runat="server" Text="Add option" Visible="False"></asp:Label> </td> <td> <asp:TextBox ID="txtOptionColor" runat="server" Visible="False"></asp:TextBox> </td> <td nowrap="nowrap"> <asp:Label ID="lblOptionColorSwatch" runat="server" Text="Swatch ID:" Visible="False"></asp:Label> </td> <td> <asp:TextBox ID="txtOptionColorSwatch" runat="server" Visible="False"></asp:TextBox> </td> <td nowrap="nowrap"> <asp:Label ID="lblOptionColorLrg" runat="server" Text="Large Image Id:" Visible="False"></asp:Label> </td> <td> <asp:TextBox ID="txtOptionColorLrg" runat="server" Visible="False"></asp:TextBox> </td> <td> <telerik:RadButton ID="btnOptionColorUpdate" runat="server" Visible="false" Text="Update"></telerik:RadButton> </td> </tr> <tr> <td nowrap="nowrap"> <asp:Label ID="lblOptionSize" runat="server" Visible="False" Text="Select a Size"></asp:Label> </td> <td> <asp:DropDownList ID="ddlOptionSize" runat="server" Visible="False"> </asp:DropDownList> </td> <td nowrap="nowrap"> <asp:Label ID="lblOptionSizeAdd" runat="server" Text="Add option" Visible="False"></asp:Label> </td> <td> <asp:TextBox ID="txtOptionSize" runat="server" Visible="False"></asp:TextBox> </td> <td> <telerik:RadButton ID="btnOptionSizeAdd" runat="server" Visible="false" Text="Add"></telerik:RadButton> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> <asp:Label ID="lblOptionWrap" runat="server" Visible="False" Text="Select Gift Wrap Option"></asp:Label> </td> <td> <asp:DropDownList ID="ddlOptionWrap" runat="server" Visible="False"> </asp:DropDownList> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td> <asp:Label ID="lblOptionShip" runat="server" Visible="False" Text="Select Shipping Restriction"></asp:Label> </td> <td> <asp:DropDownList ID="ddlOptionShip" runat="server" Visible="False"> </asp:DropDownList> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td valign="top"> <asp:Label ID="lblOptionHazMat" runat="server" Visible="False" Text="Haz Mat"></asp:Label> </td> <td> <asp:ListBox ID="lstOptionHazMat" runat="server" Rows="3" Visible="False"> </asp:ListBox> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> </td> </tr> <tr> <td colspan="4" style="WIDTH: 622px"> </td> </tr> <tr> <td colspan="5"> <telerik:RadButton ID="btnSave" runat="server" Skin="Web20" CommandName="Update"> </telerik:RadButton> <telerik:RadButton ID="btnCancel" runat="server" Skin="Web20" Text="Cancel" CommandName="Cancel"> </telerik:RadButton> </td> </tr> </table> <asp:Label ID="lblFields" runat="server"></asp:Label> <br /> </formtemplate> </editformsettings> <PagerStyle AlwaysVisible="True" /> <CommandItemTemplate> <div style="padding: 5px 5px;"> <asp:LinkButton ID="LinkButton2" runat="server" CommandName="InitInsert" Visible='<%# RadGrid1.EditIndexes.Count = 0 %>' > <img style="border:0px;vertical-align:middle;" alt="" src="../images/AddRecord.gif" />Update Selected UPCs for this Product </asp:LinkButton> <asp:LinkButton ID="LinkButton1" runat="server" CommandName="DeleteSelected" Visible='<%# RadGrid1.EditIndexes.Count = 0 %>' Enabled="True" OnClientClick="javascript:return confirm('Delete all selected UPCs?')"> <img style="border:0px;vertical-align:middle;" alt="" src="../images/Delete.gif" />Delete Selected UPCs </asp:LinkButton> <%-- <asp:LinkButton ID="DownloadPDF" runat="server" CommandName="ExportToPdf"/> <asp:Image ID="Image1" runat="server" ImageUrl="../images/PDF.gif" AlternateText="Export to PDF"/>--%> <asp:LinkButton ID="LinkButton4" runat="server" CommandName="RebindGrid"> <img style="border:0px;vertical-align:middle;" alt="" src="../images/Refresh.gif" align="right" />Refresh </asp:LinkButton> </div> </CommandItemTemplate> </mastertableview> <filtermenu enableimagesprites="False"></filtermenu> </telerik:RadGrid>Protected Sub RadGrid1_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemDataBound If (TypeOf e.Item Is GridEditFormItem AndAlso e.Item.IsInEditMode) Then With oldUPCinfo .UPCno = Session("upc") .ProductCd = Session("ProductCd") .StartDt = Session("UStartDt") .EndDt = Session("UEndDt") End With Session("OTC") = New ArrayList Dim myProduct As New WebCatVB.product oldUPCinfo = myProduct.GetProductUPC(oldUPCinfo) Dim editFormItem As GridEditFormItem = CType(e.Item, GridEditFormItem) Dim ddlRtnCodes As DropDownList = CType(editFormItem.FindControl("ddlRtnCodes"), DropDownList) Dim ddlUPCStatus As DropDownList = CType(editFormItem.FindControl("ddlUPCStatus"), DropDownList) Dim chkOverweight As CheckBox = CType(editFormItem.FindControl("chkOverweight"), CheckBox) Dim chbDropShip As CheckBox = CType(editFormItem.FindControl("chbDropShip"), CheckBox) Dim chbWebEx As CheckBox = CType(editFormItem.FindControl("chbWebEx"), CheckBox) Dim rblOverweight As RadioButtonList = CType(editFormItem.FindControl("rblOverweight"), RadioButtonList) Dim rblDropShip As RadioButtonList = CType(editFormItem.FindControl("rblDropShip"), RadioButtonList) Dim rblWebEx As RadioButtonList = CType(editFormItem.FindControl("rblWebEx"), RadioButtonList) If Session("ActionCd") = "Insert" Then CType(editFormItem.FindControl("btnSave"), RadButton).Text = "Save Selected UPCs" Else CType(editFormItem.FindControl("btnSave"), RadButton).Text = "Save UPC" End If Dim miUPC As New WebCatVB.ProductUPC Dim product As New WebCatVB.ProductObject Dim companyInfo As New WebCatVB.companyStructure Dim myUPClist As DataSet Dim upcRow As DataRow Dim strCC As String = "" If Session("ActionCd") = "Edit" Then chkOverweight.Visible = True chbDropShip.Visible = True chbWebEx.Visible = True rblOverweight.Visible = False rblDropShip.Visible = False rblWebEx.Visible = False ElseIf Session("ActionCd") = "Insert" Then chkOverweight.Visible = False chbDropShip.Visible = False chbWebEx.Visible = False rblOverweight.Visible = True rblDropShip.Visible = True rblWebEx.Visible = True End If 'get product comment product = myProduct.GetProduct(Session("productCd")) If Len(myProduct.GetError()) > 0 Then displayError(myProduct.GetError()) Exit Sub Else CType(editFormItem.FindControl("txtUPCComment"), TextBox).Text = product.commentTxt End If If Session("UPC") <> "" Then 'get mainframe UPC info myUPClist = companyInfo.getUPCS(Session("upc")) With oldUPCinfo CType(editFormItem.FindControl("dtStartDate"), RadDatePicker).SelectedDate = .StartDt If .EndDt = "12/31/9999" Then CType(editFormItem.FindControl("dtEndDate"), RadDatePicker).Clear() Else CType(editFormItem.FindControl("dtEndDate"), RadDatePicker).SelectedDate = .EndDt End If 'txtStartDt.SelectedDate = .StartDt 'If .EndDt = "12/31/9999" Then ' txtEndDt.Clear() 'Else ' txtEndDt.SelectedDate = .EndDt 'End If CType(editFormItem.FindControl("txtWebDesc"), Label).Text = .upcName ddlUPCStatus.SelectedValue = Trim(.ActiveFg) CType(editFormItem.FindControl("txtWeight"), TextBox).Text = .Weight CType(editFormItem.FindControl("txtFatCost"), TextBox).Text = .fatCost If .fatFg = "Y" Then chkOverweight.Checked = True Else chkOverweight.Checked = False End If CType(editFormItem.FindControl("txtSafetyNum"), TextBox).Text = .safetyStockNo If .preOrderdt = "" Then CType(editFormItem.FindControl("txtpreorderdt"), RadDatePicker).Clear() Else CType(editFormItem.FindControl("txtpreorderdt"), RadDatePicker).SelectedDate = .preOrderdt End If CType(editFormItem.FindControl("txtBackOrder"), TextBox).Text = .backOrderTimeFrame If .dropShipFlg = "Y" Then chbDropShip.Checked = True Else chbDropShip.Checked = False End If If .webExclusiveFlg = "Y" Then chbWebEx.Checked = True Else chbWebEx.Checked = False End If CType(editFormItem.FindControl("txtSHF"), TextBox).Text = .SHF End With For Each upcRow In myUPClist.Tables("UPClist").Rows CType(editFormItem.FindControl("LabelUPC11"), Label).Visible = True CType(editFormItem.FindControl("lblSSNdc"), Label).Text = upcRow("upcDc") CType(editFormItem.FindControl("lblColor"), Label).Text = "Color - " + upcRow("colorDc") CType(editFormItem.FindControl("lblSize"), Label).Text = "Size - " + upcRow("sizeDc") If IsDBNull(upcRow("CLR_CDE")) = True Then strCC = "" Else strCC = upcRow("CLR_CDE") End If Next 'GET COLOR FAMILY BASED ON THE COLOR CODE If strCC <> "" Then CType(editFormItem.FindControl("lblColorFamily"), Label).Text = "Color Family - " + getColorFamily(strCC) End If Else ddlStatus.Items.Insert(0, "") End If populateReturnCodes(oldUPCinfo.dropShipFlg, ddlRtnCodes) If oldUPCinfo.ReturnCode IsNot Nothing Then ddlRtnCodes.SelectedValue = Trim(oldUPCinfo.ReturnCode) Else ddlRtnCodes.SelectedValue = 0 End If getControls(editFormItem) End IfEnd SubSub populateReturnCodes(ByVal strDS As String, ByVal ddlRtnCodes As DropDownList) Dim mySearch As New WebCatVB.product Dim dsResults As New DataSet dsResults = mySearch.getUPCReturnCodes(strDS) If Session("ActionCd") = "Insert" Then Dim newRow As DataRow = dsResults.Tables("Codes").NewRow() newRow("ENTRY2_TXT") = 0 newRow("ENTRY_DESC") = "" dsResults.Tables("Codes").Rows.Add(newRow) End If ddlRtnCodes.DataSource = dsResults ddlRtnCodes.DataValueField = "ENTRY2_TXT" ddlRtnCodes.DataTextField = "ENTRY_DESC" ddlRtnCodes.DataBind() End SubPrivate Function getColorFamily(ByVal strCC As Integer) As String Dim strCF As String = "" Select Case strCC Case 1 To 99 strCF = "Black" Case 100 To 199 strCF = "White" End Select Return strCF End FunctionSub getControls(ByVal editFormItem As GridEditFormItem) Dim myOptions As New WebCatVB.options Dim myOptionSelect As New WebCatVB.product Dim dvOptions As New DataView Dim dvOptionTypes As New DataView Dim dsOptionSelect As New DataSet Dim optRow As DataRow 'Decide which page to join or not join with the product options If Session("currentPage") = "WebCategory_UPCSearch" Then dvOptions = myOptions.getOptionTypes(False, , "where Active_Flg = 'A' and DISPLAY_AS_ATTRIB='Y' ") Else dvOptions = myOptions.getOptionTypes(True, Session("ProductCd"), "where Active_Flg = 'A' and DISPLAY_AS_ATTRIB='Y'") End If If Len(myOptions.GetError()) > 0 Then displayError(myOptions.GetError()) Exit Sub End If For Each row As DataRowView In dvOptions Dim OptionName As String = row.Item("OptionTypeName") If row.Item("SwatchFg").ToString() = "Y" Then dvOptionTypes = myOptions.getOptions(row.Item("OptionTypeCd").ToString(), " where OPTION_TYPE_CDE = " & row.Item("OptionTypeCd").ToString() & " and swatch_product_cde = " & Session("ProductCd"), "order by OPTION_NME") Else dvOptionTypes = myOptions.getOptions(row.Item("OptionTypeCd").ToString(), " where OPTION_TYPE_CDE = " & row.Item("OptionTypeCd").ToString() & " and swatch_product_cde = 0", "order by OPTION_NME") End If dsOptionSelect = myOptionSelect.GetUPCoptions(Session("UPC"), (row.Item("OptionTypeCd").ToString()), Session("ProductCd")) Select Case OptionName Case "Color" CType(editFormItem.FindControl("lblOptionColor"), Label).Visible = True loadDropDown(CType(editFormItem.FindControl("ddlOptionColor"), DropDownList), dsOptionSelect, dvOptionTypes) Case "Size" CType(editFormItem.FindControl("lblOptionSize"), Label).Visible = True loadDropDown(CType(editFormItem.FindControl("ddlOptionSize"), DropDownList), dsOptionSelect, dvOptionTypes) Case "Gift Wrap" CType(editFormItem.FindControl("lblOptionWrap"), Label).Visible = True loadDropDown(CType(editFormItem.FindControl("ddlOptionWrap"), DropDownList), dsOptionSelect, dvOptionTypes) Case "Shipping Restrictions" CType(editFormItem.FindControl("lblOptionShip"), Label).Visible = True loadDropDown(CType(editFormItem.FindControl("ddlOptionShip"), DropDownList), dsOptionSelect, dvOptionTypes) Case "Haz Mat" CType(editFormItem.FindControl("lblOptionHazMat"), Label).Visible = True 'lblOptionHazMat.Visible = True Dim lstOptionHazMat As ListBox = CType(editFormItem.FindControl("lstOptionHazMat"), ListBox) lstOptionHazMat.Visible = True lstOptionHazMat.DataSource = dvOptionTypes lstOptionHazMat.DataValueField = "Option_Cde" lstOptionHazMat.DataTextField = "Option_Nme" lstOptionHazMat.DataBind() If dsOptionSelect.Tables("upcOptions") IsNot Nothing Then For Each optRow In dsOptionSelect.Tables("upcOptions").Rows For x As Integer = 0 To lstOptionHazMat.Items.Count - 1 If lstOptionHazMat.Items(x).Value = optRow("OptCd") Then lstOptionHazMat.Items(x).Selected = True 'Add to array 'lblUpdate.Text = lblUpdate.Text & optRow("OptCd") & "," End If Next Next End If End Select NextEnd SubSub loadDropDown(ByVal ddl As DropDownList, ByVal dsOptionSelect As DataSet, ByVal dvOptionTypes As DataView) Dim optRow As DataRow ddl.Visible = True ddl.DataSource = dvOptionTypes ddl.DataValueField = "Option_Cde" ddl.DataTextField = "Option_Nme" ddl.DataBind() If dsOptionSelect.Tables("upcOptions") IsNot Nothing Then For Each optRow In dsOptionSelect.Tables("upcOptions").Rows For x As Integer = 0 To ddl.Items.Count - 1 If ddl.Items(x).Value = optRow("OptCd") Then ddl.Items(x).Selected = True 'Add to array 'lblUpdate.Text = lblUpdate.Text & optRow("OptCd") & "," End If Next Next End IfEnd SubIt seems like performance gets a lot worse when the method getControls() is initally called which does not make sense becuase it is not called upon closing the form.
Any hints or tips would be greatly appreciated.
Thanks,
Casey