[CLOSED] user control in anchor

  1. #1

    [CLOSED] user control in anchor

    Hello,

    I would like to create a custom user control containing a store and a combobox:

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ComboBoxHeading.ascx.cs" Inherits="Truvo.Web.KWI.Controls.ComboBoxHeading" %>
    
        <asp:ObjectDataSource ID="HeadingDataSource" runat="server" SelectMethod="StartsWith" TypeName="Truvo.Web.KWI.DB.Heading"
            OnSelected="HeadingDataSource_Selected">
            <SelectParameters>
                <asp:Parameter Name="Start" Type="Int32" DefaultValue="0" />
                <asp:Parameter Name="Limit" Type="Int32" DefaultValue="15" />
                <asp:Parameter Name="SortField" />
                <asp:Parameter Name="SortDir" />
                <asp:Parameter Name="InputString" Type="String" />
                <asp:Parameter Name="Count" Direction="Output" Type="Int32" />
            </SelectParameters>
        </asp:ObjectDataSource>
    
        <ext:Store ID="HeadingStore" runat="server" AutoLoad="true" RemoteSort="true" DataSourceID="HeadingDataSource" ShowWarningOnFailure="true"
            OnRefreshData="HeadingStore_RefreshData">
            <AjaxEventConfig IsUpload="true" />
            <Proxy>
                <ext:DataSourceProxy />
            </Proxy>
    
            <Reader>
                <ext:JsonReader ReaderID="RowNumber">
                    <Fields>
                        <ext:RecordField Name="Code" />
                        <ext:RecordField Name="Name" />
                        <ext:RecordField Name="Locale" />
                        <ext:RecordField Name="NameString" />
                        <ext:RecordField Name="LocaleString" />
                    </Fields>
                </ext:JsonReader>
            </Reader>
    
            <BaseParams>
                <ext:Parameter Name="InputString" Value="#{cbHeading}.getValue();" Mode="Raw" />
            </BaseParams>
        </ext:Store>
    
        <ext:ComboBox ID="cbHeading" runat="server" StoreID="HeadingStore" DisplayField="Name" ValueField="Code"
            TypeAhead="false" LoadingText="Searching..." Width="200" PageSize="15" HideTrigger="true"
            ItemSelector="div.search-item" MinChars="1" ForceSelection="false" FieldLabel="#Heading#">
            <Template runat="server">
               <tpl for=".">
                  <div class="search-item">
                     <span class="name">{NameString}</span> <span class="locale">{LocaleString}</span>
                  </div>
               </tpl>
            </Template>
        </ext:ComboBox>
    and then put this control inside an anchor in a FormLayout.

    the problem is I am getting this error:
    Coolite.Ext.Web.ItemsCollection`1[[Coolite.Ext.Web.Component, Coolite.Ext.Web, Version=0.8.3.27681, Culture=neutral, PublicKeyToken=f58c952e9aa5b80a]] must have items of type 'Coolite.Ext.Web.Component'. 'user:ComboBoxHeading' is of type 'ASP.controls_comboboxheading_ascx'.
    how can I achieve this (using Coolite 0.8)?
    Last edited by geoffrey.mcgill; Dec 06, 2010 at 4:05 PM. Reason: [CLOSED]
  2. #2
    Hi,

    Please try the following thing.

    Example
    <ext:Anchor>
        <ext:Panel runat="server">
            <Body>
                <uc:UserControl runat="server" />
            </Body>
        </ext:Panel>
    </ext:Anchor>
  3. #3
    thanks, this worked to display the control and avoid any errors.
    I still have one problem though, the label is not displayed. I have tried setting the FieldLabel property of the Panel but didn't display anything.

    Do you know how I could make this work?
  4. #4
    Please wrap ComboBox in FormLayout control.

    Example
    <ext:Store runat="server" ...>
        ...
    </ext:Store>
    <ext:FormLayout runat="server">
        <ext:Anchor>
            <ext:ComboBox runat="server" FieldLabel="FieldLabel" ...>
                ...
            </ext:ComboBox>
        </ext:Anchor>
    </ext:FormLayout>
  5. #5
    that worked.
    thanks a lot

Similar Threads

  1. Replies: 2
    Last Post: Feb 06, 2012, 9:06 AM
  2. how to upload user control dynamicaly on user control
    By archana mahadule in forum 1.x Help
    Replies: 1
    Last Post: Jan 13, 2011, 12:05 PM
  3. Replies: 1
    Last Post: Nov 09, 2010, 3:30 PM
  4. 2 control in Anchor
    By olimpia in forum 1.x Help
    Replies: 3
    Last Post: Jun 16, 2009, 5:46 PM
  5. How to anchor control in toolbar?
    By dbassett74 in forum 1.x Help
    Replies: 0
    Last Post: May 12, 2009, 12:14 PM

Posting Permissions