[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
Code:
<%@ 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
Code:
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
Code:
<%@ 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;