[CLOSED] User Control in Code Behind

  1. #1

    [CLOSED] User Control in Code Behind

    Hello all


    I'm trying to show a usercontrol via code, made the screen and the usercontrol how do I show him when I click the button?

    WebForm1.aspx
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Consorcio.Web.Sistema.Cadastros.WebForm1" %>
    
    
    <%@ Register Src="~/Sistema/Cadastros/frmCotasMan.ascx" TagPrefix="uc1" TagName="frmCotasMan" %>
    
    
    
    
    <!DOCTYPE html>
    
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
            <div>
                <ext:ResourceManager runat="server" />
                <ext:Button ID="btnIncluir" runat="server" Text="Adicionar" Icon="UserAdd" ToolTip="Adicionar um novo" OnDirectClick="btnIncluir_Click">
                </ext:Button>
                <uc1:frmCotasMan runat="server" ID="frmCotasMan" />
            </div>
        </form>
    </body>
    </html>
    WebForm1.cs

    using Ext.Net;
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    
    
    namespace Consorcio.Web.Sistema.Cadastros
    {
        public partial class WebForm1 : System.Web.UI.Page
        {
            protected void Page_Load(object sender, EventArgs e)
            {
    
    
            }
    
    
            protected void btnIncluir_Click(object sender, DirectEventArgs e)
            {
                //???
            }
        }
    }
    frmCotasMan.ascx

    <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="frmCotasMan.ascx.cs" Inherits="Consorcio.Web.Sistema.Cadastros.frmCotasMan" %>
    
    
    <ext:Window ID="WindowCadastro" runat="server" Icon="Map" Title="Dados da Categoria"
        Hidden="true" Modal="true" Width="1300" AutoHeight="true" Resizable="false" Closable="false">
        <Items>
            <ext:FormPanel ID="FormPanel1" runat="server" Padding="1" Layout="VBoxLayout" BodyStyle="background-color: transparent;" Frame="true" BodyPadding="1" Header="false" Visible="false">
                <FieldDefaults LabelAlign="Right" LabelWidth="80" MsgTarget="Side" />
    
    
                <Defaults>
                    <ext:Parameter Name="Border" Value="false" />
                    <ext:Parameter Name="Flex" Value="1" />
                    <ext:Parameter Name="Layout" Value="anchor" />
                </Defaults>
    
    
                <Items>
                </Items>
            </ext:FormPanel>
        </Items>
    </ext:Window>


    Tks;
    Last edited by Daniil; Mar 26, 2015 at 8:24 PM. Reason: [CLOSED]
  2. #2
  3. #3
    Close the Thread.

    Tks

Similar Threads

  1. Replies: 1
    Last Post: Jan 26, 2015, 3:42 PM
  2. Replies: 2
    Last Post: May 09, 2013, 3:41 PM
  3. Replies: 4
    Last Post: Feb 16, 2012, 6:06 PM
  4. Replies: 2
    Last Post: Feb 06, 2012, 9:06 AM
  5. [CLOSED] Problem loading user control from code behind
    By jmcantrell in forum 1.x Legacy Premium Help
    Replies: 8
    Last Post: Jul 18, 2011, 9:02 PM

Posting Permissions