[CLOSED] Problem placing Custom control on Top bar of Panel

  1. #1

    [CLOSED] Problem placing Custom control on Top bar of Panel

    I created a new custom control, I'm able to place that control in panel but I was unable to place it in Topbar of Panel. Can you please help me on it.
    Last edited by Daniil; Nov 15, 2010 at 8:36 AM. Reason: [CLOSED]
  2. #2
    Hi,

    Please clarify how do you try to achieve this? What is the content of user control?

    Could you provide an example like the following one?

    Example
    <%@ Page Language="C#" %>
    
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <%@ Register Src="~/User controls/TestUserControl.ascx" TagPrefix="uc" TagName="TestUserControl" %>
    <!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>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
        <ext:Toolbar runat="server">
            <Content>
                <uc:TestUserControl runat="server" />
            </Content>
        </ext:Toolbar>
        </form>
    </body>
    </html>
    User Control
    <%@ Control Language="C#" %>
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
     
    <ext:DisplayField runat="server" Text="Hello from User Control!"/>
  3. #3

    Its TopBar not a tool bar

    User Control ASCX.

    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="cmbItem.ascx.cs" Inherits="cmbItem" %>
    <style type="text/css">
        .search-item
        {
            font: normal 11px tahoma, arial, helvetica, sans-serif;
            padding: 3px 10px 3px 10px;
            border: 1px solid #fff;
            border-bottom: 1px solid #eeeeee;
            white-space: normal;
            color: #555;
        }
        
        .search-item h3
        {
            display: block;
            font: inherit;
            font-weight: bold;
            color: #222;
        }
        
        .search-item h3 span
        {
            float: right;
            font-weight: normal;
            margin: 0 0 5px 5px;
            width: 100px;
            display: block;
            clear: none;
        }
        
        p
        {
            width: 650px;
        }
        
        .ext-ie .x-form-text
        {
            position: static !important;
        }
    </style>
    <ext:Store runat="server" ID="stItemNo" OnRefreshData="stItemNo_RefreshData">
        <Proxy>
            <ext:PageProxy />
        </Proxy>
        <Reader>
            <ext:JsonReader>
                <Fields>
                    <ext:RecordField Name="ItemNo" />
                    <ext:RecordField Name="ItemId" />
                    <ext:RecordField Name="Description" />
                </Fields>
            </ext:JsonReader>
        </Reader>
        <AutoLoadParams>
            <ext:Parameter Name="start" Value="0" Mode="Raw" />
            <ext:Parameter Name="limit" Value="15" Mode="Raw" />
        </AutoLoadParams>
    </ext:Store>
    <ext:ComboBox ID="cmbItemNo" Width="270" runat="server" StoreID="stItemNo" TypeAhead="false"
        HideReferesh="true" MinChars="1" HideTrigger="true" DisplayField="ItemNo" ValueField="ItemId"
        ItemSelector="div.search-item" PageSize="2">
        <Template ID="Template1" runat="server">
            <Html>
                <tpl for=".">
                    <div class="search-item">
                        <h3><span>{ItemNo}</span></h3>
                        {Description}
                    </div>
                </tpl>
            </Html>
        </Template>
    </ext:ComboBox>
    Inherting Page
    <%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
    <%@ Register Src="~/User controls/cmbItem.ascx" TagPrefix="uc" TagName="TestUserControl" %>
    <!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>Ext.Net Example</title>
    </head>
    <body>
        <form runat="server">
        <ext:ResourceManager runat="server" />
                    <ext:Panel ID="ItemInfo" Title="Item Information" runat="server">
                        <TopBar>
                            <ext:Toolbar ID="Toolbar1" runat="server">
                                <Items>
                                    <cmb:cmbItems Id="cmbItemNo" Width="270" runat="server" />
                                    <ext:Label ID="lblItem" runat="server" Text="Search Item:" />                                
                                    <ext:ToolbarSpacer />
                                    <ext:Button ID="btnGetItem" Pressed="true" Text="Get Item Details" runat="server"
                                        Cls="btnCommonImage" Width="80px" Height="18px" >
                                        <DirectEvents>
                                            <Click OnEvent= "GetItemDetails" />
                                        </DirectEvents>
                                    </ext:Button>
                                    <ext:ToolbarSpacer />
                                </Items>
                            </ext:Toolbar>
                        </TopBar>
                </ext:Panel>
    </form>
    </body>
    </html>
    Last edited by Daniil; Nov 15, 2010 at 8:35 AM.
  4. #4
    Hi,

    Please wrap sample code in [CODE ] tags, see
    http://forums.ext.net/showthread.php...ing-New-Topics

    Regarding the question

    There are two ways to achieve your requirement.

    1. Wrapping a user control in a <ext:Container>. It's more preferable.

    Example
    <ext:Toolbar runat="server">
        <Items>
            <ext:Container runat="server">
                <Content>
                    <uc:TestUserControl runat="server" />
                </Content>
            </ext:Container>
            <ext:DisplayField runat="server" Text="Hello from Items!" />
        </Items>
    </ext:Toolbar>
    2. Using <Content> instead of <Items>

    Example

    <ext:Toolbar runat="server">
        <Content>
            <uc:TestUserControl runat="server" />
            <ext:DisplayField runat="server" Text="Hello from Items!" />
        </Content>
    </ext:Toolbar>
    Last edited by geoffrey.mcgill; Feb 20, 2011 at 12:23 PM.
  5. #5

    Throwing an error

    Thanks for your reply daniil, while I'm using the <ext:Container> It complied with out any error, but while I'm running the application its throwing an error I attached the print screen.
    While I'm using the <Content> in toolbar(2nd way) while compiling its throwing an error "Type 'Ext.Net.Toolbar' does not have a public property named 'Content'."
    Attached Thumbnails Click image for larger version. 

Name:	abc.jpg 
Views:	143 
Size:	89.2 KB 
ID:	1885  
  6. #6
    Quote Originally Posted by sriram View Post
    Thanks for your reply daniil, while I'm using the <ext:Container> It complied with out any error, but while I'm running the application its throwing an error I attached the print screen.
    There is a Store in the user control. Please try a Panel instead of Container.

    Quote Originally Posted by sriram View Post
    While I'm using the <Content> in toolbar(2nd way) while compiling its throwing an error "Type 'Ext.Net.Toolbar' does not have a public property named 'Content'."
    Could you try to run the example from the second post of this thread? If the same error will throw please update from SVN.
  7. #7

    Issue Solved

    Thanks daniil, by the first way it fixed the issue

Similar Threads

  1. Replies: 8
    Last Post: Aug 13, 2012, 11:47 PM
  2. Replies: 2
    Last Post: Jan 09, 2012, 7:18 AM
  3. [CLOSED] Custom event in custom tree panel not being generated
    By anup in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Dec 31, 2011, 8:45 PM
  4. [CLOSED] Custom control : Problem of display.
    By ddslogistics in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Dec 14, 2010, 5:40 PM
  5. Placing checkbox in the dropdown List
    By n_s_adhikari@rediffmail.com in forum 1.x Help
    Replies: 1
    Last Post: Apr 24, 2010, 7:39 PM

Tags for this Thread

Posting Permissions