Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
655
Error Creating Control - WebDropDown (The ConnectionString property has not been initialized)
posted

Hi, I am trying out the WebhierarchicalDataGrid as a templated control in the WebDropDown. I have followed this tutorial http://help.infragistics.com/Help/Doc/ASPNET/2011.2/CLR4.0/html/WebDropDown_Create_a_Multi_Column_WebDropDown_using_Templates.html replacing the WebDataGrid with the WebHierarchicalDataGrid. Everything works fine except when I close the template editing on the WebDropDown the WebDropDown does not render in Design view. It says Error Creating Control - WebDropDown (The ConnectionString property has not been initialized). I am then unable to access the smart tag for the control and therefore unable to edit the control through the GUI. Below is an example of this issue.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default5.aspx.vb" Inherits="Default5" %>

<%@ Register Assembly="Infragistics4.Web.v14.2, Version=14.2.20142.2146, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.Web.UI" TagPrefix="ig" %>
<%@ Register Assembly="Infragistics4.Web.v14.2, Version=14.2.20142.2146, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.Web.UI.ListControls" TagPrefix="ig" %>
<%@ Register Assembly="Infragistics4.Web.v14.2, Version=14.2.20142.2146, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>
<%@ Register Assembly="Infragistics4.Web.v14.2, Version=14.2.20142.2146, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb"
Namespace="Infragistics.Web.UI.DataSourceControls" TagPrefix="ig" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<ig:WebScriptManager ID="WebScriptManager1" runat="server">
</ig:WebScriptManager>
</div>
<ig:WebDropDown ID="WebDropDown2" runat="server" Width="200px">
<Items>
<ig:DropDownItem Selected="False" Text="Products" Value="">
<Template>
<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" runat="server" AutoGenerateBands="False"
AutoGenerateColumns="False" DataMember="SqlDataSource1_DefaultView" DataSourceID="WebHierarchicalDataSource1"
Height="350px" Key="SqlDataSource1_DefaultView" Width="400px">
<Columns>
<ig:BoundDataField DataFieldName="ProductID" Key="ProductID">
<Header Text="ProductID" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="ProductName" Key="ProductName">
<Header Text="ProductName" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="SupplierID" Key="SupplierID">
<Header Text="SupplierID" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="CategoryID" Key="CategoryID">
<Header Text="CategoryID" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="QuantityPerUnit" Key="QuantityPerUnit">
<Header Text="QuantityPerUnit" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="UnitPrice" Key="UnitPrice">
<Header Text="UnitPrice" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="UnitsInStock" Key="UnitsInStock">
<Header Text="UnitsInStock" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="UnitsOnOrder" Key="UnitsOnOrder">
<Header Text="UnitsOnOrder" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="ReorderLevel" Key="ReorderLevel">
<Header Text="ReorderLevel" />
</ig:BoundDataField>
<ig:BoundCheckBoxField DataFieldName="Discontinued" Key="Discontinued">
<Header Text="Discontinued" />
</ig:BoundCheckBoxField>
</Columns>
<Behaviors>
<ig:Selection CellClickAction="Row" RowSelectType="Single">
</ig:Selection>
</Behaviors>
</ig:WebHierarchicalDataGrid>
<ig:WebHierarchicalDataSource ID="WebHierarchicalDataSource1" runat="server">
<DataViews>
<ig:DataView ID="SqlDataSource1_DefaultView" DataMember="DefaultView" DataSourceID="SqlDataSource1" />
</DataViews>
</ig:WebHierarchicalDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT * FROM [Products]"></asp:SqlDataSource>
</Template>
</ig:DropDownItem>
</Items>
</ig:WebDropDown>
</form>
</body>
</html>

  • 20255
    Verified Answer
    Offline posted

    Hello,

    Thank you for your question, this is happening because you've put the data sources definitions into the item template. Put them after the WebDropDown definition and the GUI will be available again.

    Code snippet:

    .....................

    1.                                 <Behaviors>
    2.                                     <ig:Selection CellClickAction="Row" RowSelectType="Single">
    3.                                     </ig:Selection>
    4.                                 </Behaviors>
    5.                             </ig:WebHierarchicalDataGrid>
    6.  
    7.                         </Template>
    8.                     </ig:DropDownItem>
    9.                 </Items>
    10.             </ig:WebDropDown>
    11.  
    12.             <ig:WebHierarchicalDataSource ID="WebHierarchicalDataSource1" runat="server">
    13.                 <DataViews>
    14.                     <ig:DataView ID="SqlDataSource1_DefaultView" DataMember="DefaultView" DataSourceID="SqlDataSource1" />
    15.                 </DataViews>
    16.             </ig:WebHierarchicalDataSource>
    17.             <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
    18.                 SelectCommand="SELECT * FROM [Products]" ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"></asp:SqlDataSource>
    19.         </div>
    20.     </form>
    21. </body>
    22. </html>

    Let me know if I may be of further assistance.