Mar 26, 2014, 5:12 PM
[CLOSED] Problems with Custom Window with Record Details
HI Team
I?m trying to run the following example:
https://examples2.ext.net/#/GridPane...Window_Remote/
but not able to obtain similar results.
I made the following code, to see if you guys can help me or tell me what i'm doing wrong or another example
to get a similar result.
Page
I?m trying to run the following example:
https://examples2.ext.net/#/GridPane...Window_Remote/
but not able to obtain similar results.
I made the following code, to see if you guys can help me or tell me what i'm doing wrong or another example
to get a similar result.
Page
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm4.aspx.cs" Inherits="Web2.WebForm4" %>
<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register Src="~/WebUserControl3.ascx" TagPrefix="uc1" TagName="WebUserControl3" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<meta http-equiv="X-UA-Compatible" content="IE=9, chrome=1"/>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="Form1" runat="server">
<ext:ResourceManager ID="ResourceManager1" runat="server" IDMode="Explicit" Theme="Neptune"/>
<div style="margin:20px auto 20px auto; width:80%; padding:20px;">
<ext:FormPanel ID="frmpData" runat="server"
Border="false" Icon="GroupKey" Layout="Form">
<Items>
<ext:GridPanel ID="grpData" runat="server"
Height="300"
Layout="AnchorLayout"
ForceFit="true">
<Store>
<ext:Store ID="StoreData" runat="server"
RemoteSort="true"
OnReadData="StoreData_ReadData"
PageSize="10">
<Proxy>
<ext:PageProxy>
<Listeners>
<Exception Handler="Ext.MessageBox.alert('Load failed', response.statusText);" />
</Listeners>
</ext:PageProxy>
</Proxy>
<Model>
<ext:Model runat="server">
<Fields>
<ext:ModelField Name="TABLE_COL1" />
<ext:ModelField Name="TABLE_COL2" />
<ext:ModelField Name="TABLE_COL3" />
<ext:ModelField Name="TABLE_COL4" />
<ext:ModelField Name="TABLE_COL5" />
<ext:ModelField Name="TABLE_COL6" />
</Fields>
</ext:Model>
</Model>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:RowNumbererColumn ID="RowNumbererColumn1" runat="server" />
<ext:Column ID="Column1" runat="server" Text="Fiscalizador" DataIndex="TABLE_COL1"/>
<ext:Column ID="Column2" runat="server" Text="Documento" DataIndex="TABLE_COL2"/>
<ext:Column ID="Column3" runat="server" Text="Tipo" DataIndex="TABLE_COL3"/>
<ext:Column ID="Column4" runat="server" Text="Correo" DataIndex="TABLE_COL4"/>
<ext:Column ID="Column5" runat="server" Text="Smartphone" DataIndex="TABLE_COL5"/>
<ext:Column ID="Column6" runat="server" Text="Estado" DataIndex="TABLE_COL6"/>
</Columns>
</ColumnModel>
<TopBar>
<ext:Toolbar ID="Toolbar1" runat="server">
<Items>
<ext:Button ID="btnAgregar" runat="server" Text="Nuevo" Icon="UserAdd" ToolTip="New Record">
<DirectEvents>
<Click OnEvent="btnAgregar_Click" Failure="Ext.MessageBox.alert('Fiscalizador', 'Error evento grabar');">
</Click>
</DirectEvents>
</ext:Button>
<ext:ToolbarFill ID="ToolbarFill1" runat="server" />
</Items>
</ext:Toolbar>
</TopBar>
<BottomBar>
<ext:PagingToolbar ID="PagingToolbar1"
runat="server"
DisplayInfo="true"
DisplayMsg="Displaying Data {0} - {1} of {2}"
EmptyMsg="No data to display" />
</BottomBar>
</ext:GridPanel>
</Items>
</ext:FormPanel>
<uc1:WebUserControl3 runat="server" ID="WebUserControl3" />
</div>
</form>
</body>
</html>
Page - Codebehind
using System;
using System.Collections.Generic;
using Ext.Net;
namespace Web2
{
public partial class WebForm4 : System.Web.UI.Page
{
protected void Page_Init(object sender, EventArgs e)
{
this.WebUserControl3.GridStore = this.StoreData;
}
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (IsPostBack == false)
{
Bloque1_Query();
}
}
catch (Exception ex)
{
MensajeNotificacion("Iniciar", Icon.Error, "<p align='left'>Error " + ex.Message + "</p>");
}
}
protected void StoreData_ReadData(object sender, StoreReadDataEventArgs e)
{
Bloque1_Query();
}
protected void btnAgregar_Click(object sender, DirectEventArgs e)
{
try
{
WebUserControl3.Bloque1_Show();
}
catch (Exception ex)
{
MensajeNotificacion("Evento Nuevo Fiscalizador", Icon.Error, "<p align='left'>Error " + ex.Message + "</p>");
}
}
private void MensajeNotificacion(string ptheTitle, Ext.Net.Icon ptheIcon, string ptheMensaje)
{
NotificationConfig theNotificationConfig = new NotificationConfig();
theNotificationConfig.Title = ptheTitle;
theNotificationConfig.Icon = ptheIcon;
theNotificationConfig.Html = "<p align='left'>" + ptheMensaje + "</p>";
theNotificationConfig.HideDelay = 2500;
theNotificationConfig.ShowPin = true;
Ext.Net.Notification.Show(theNotificationConfig);
}
private void Bloque1_Query()
{
System.Data.DataTable theDataTable = DataBase.Table;
StoreData.DataSource = theDataTable;
StoreData.DataBind();
}
}
}
UserControl
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl3.ascx.cs" Inherits="Web2.WebUserControl3" %>
<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
<ext:Window ID="NewRecord" runat="server"
Title="New Record"
Icon="Group"
Modal="true"
Width="450"
Height="350"
Hidden="true"
Layout="Fit">
<Items>
<ext:FormPanel ID="frmNewRecord" runat="server"
DefaultAnchor="100%"
BodyPadding="5">
<Items>
<ext:TextField ID="txtPersona" runat="server" FieldLabel="Persona"/>
<ext:TextField ID="txtEmpresa" runat="server" FieldLabel="Empresa"/>
<ext:TextField ID="txtTipoFiscal" runat="server" FieldLabel="Tipo"/>
<ext:TextField ID="txtCorreo" runat="server" FieldLabel="Correo"/>
<ext:TextField ID="txtSmartphone" runat="server" FieldLabel="Smartphone"/>
<ext:TextField ID="txtDesde" runat="server" FieldLabel="Desde"/>
<ext:TextField ID="txtHasta" runat="server" FieldLabel="Hasta"/>
<ext:TextField ID="txtEstado" runat="server" FieldLabel="Estado"/>
</Items>
</ext:FormPanel>
</Items>
<Buttons>
<ext:Button ID="btnInsert" runat="server" Text="Grabar" Icon="Disk" ToolTip="Crea Nuevo Registro">
<DirectEvents>
<Click OnEvent="btnInsert_Click" Failure="Ext.MessageBox.alert('Grabar ha fallado', 'Error al grabar registro');">
<EventMask ShowMask="true" Target="CustomTarget" CustomTarget="={#{NewRecord}.body}" />
</Click>
</DirectEvents>
<Listeners>
<Click Handler="#{NewRecord}.hide();" />
</Listeners>
</ext:Button>
<ext:Button ID="btnCancel" runat="server" Text="Cancelar" Icon="Cancel" ToolTip="Cancela y Cierra Ventana">
<Listeners>
<Click Handler="#{NewRecord}.hide();" />
</Listeners>
</ext:Button>
</Buttons>
</ext:Window>
UserControl - Codebehind
namespace Web2
{
public partial class WebUserControl3 : System.Web.UI.UserControl
{
public Store GridStore { get; set; }
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!Page.IsPostBack)
{
}
}
catch (Exception ex)
{
MensajeNotificacion("Evento Cargar P?gina", Icon.Information, "Error " + ex.Message);
}
}
protected void btnInsert_Click(object sender, DirectEventArgs e)
{
try
{
if (Bloque1_Insert() == true)
{
MensajeNotificacion("Insertar Registro", Icon.Accept, "Se ha realizado la transacci?n con ?xito");
}
}
catch (Exception ex)
{
MensajeNotificacion("Evento Grabar", Icon.Information, "Error " + ex.Message);
}
}
private void MensajeNotificacion(string ptheTitle, Ext.Net.Icon ptheIcon, string ptheMensaje)
{
NotificationConfig theNotificationConfig = new NotificationConfig();
theNotificationConfig.Title = ptheTitle;
theNotificationConfig.Icon = ptheIcon;
theNotificationConfig.Html = "<p align='left'>" + ptheMensaje + "</p>";
theNotificationConfig.HideDelay = 2500;
theNotificationConfig.ShowPin = true;
Ext.Net.Notification.Show(theNotificationConfig);
}
private bool Bloque1_Insert()
{
return (theU01E974.Insert() == 1 ? true : false);
}
public void Bloque1_Show()
{
Bloque1_RecordClear();
NewRecord.Show();
}
private void Bloque1_RecordClear()
{
txtPersona.Text = "";
txtEmpresa.Text = "";
txtTipoFiscal.Text = "";
txtCorreo.Text = "";
txtSmartphone.Text = "";
txtDesde.Text = "";
txtHasta.Text = "";
txtEstado.Text = "";
}
}
}
Any help is appreciated.
Last edited by Daniil; Apr 03, 2014 at 4:07 AM.
Reason: [CLOSED]