PDA

View Full Version : [CLOSED] Text value of TextField object in UserControl



Mario
Nov 14, 2014, 6:49 AM
Test.aspx


<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Test.aspx.vb" Inherits="B2B.WEB.Test" %>

<%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">

<ext:ResourceManager runat="server" />

<ext:TextField ID="TextField1" runat="server" />
<ext:Button ID="ButtonTestASPX" runat="server" Text="test ASPX" Icon="Accept" OnDirectClick="ButtonTestASPX_Click" />

<ext:Panel ID="PanelControl" runat="server" Width="500" Border="true" />

</form>
</body>
</html>


Test.aspx.vb


Public Class Test
Inherits System.Web.UI.Page

Private Sub Test_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim ControlApp As New Ext.Net.UserControlLoader
ControlApp.Path = "Control.ascx"
PanelControl.Items.Add(ControlApp)
PanelControl.UpdateContent()
End Sub

Protected Sub ButtonTestASPX_Click(sender As Object, e As Ext.Net.DirectEventArgs)
Ext.Net.X.Msg.Alert("Message", TextField1.Text).Show()
End Sub

End Class


Control.ascx


<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Control.ascx.vb" Inherits="B2B.WEB.Control" %>

<ext:TextField ID="TextField1" runat="server" />
<ext:Button ID="ButtonTestASCX" runat="server" Text="test ASCX" Icon="Accept" ClientIDMode="Static" OnDirectClick="ButtonTestASCX_Click" />

Control.ascx.vb


Public Class Control
Inherits System.Web.UI.UserControl

Protected Sub ButtonTestASCX_Click(sender As Object, e As Ext.Net.DirectEventArgs)
Ext.Net.X.Msg.Alert("Message", TextField1.Text).Show()
End Sub

End Class


When I click on TestASPX Button, all OK.
When I click on TestASCX Button, nothing is showed...

Help, please!

Daniil
Nov 14, 2014, 9:29 AM
Hi @Mario,

Please remove:

PanelControl.UpdateContent()

It should be called during a DirectEvent only if needed to update the PanelControl's content.