Nov 13, 2014, 9:13 AM
[CLOSED] OnDirectClick on UserControl
Hi,
I need to execute a work when I click on Button that is in UserControl loaded dinamically.
But the code returns error....
The code:
Test.aspx
Test.aspx.vb
Control.ascx
Control.ascx.vb
When I run the code, appear two button.
If I click on first button, all OK... and the message will be showed.
If I click on second button... will display an error and the message will not be shown.
Can you help me?
Tnx!
I need to execute a work when I click on Button that is in UserControl loaded dinamically.
But the code returns error....
The code:
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>
<ext:ResourceManager 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" />
</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", "Hello ASPX").Show()
End Sub
End Class
Control.ascx
<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Control.ascx.vb" Inherits="B2B.WEB.Control" %>
<ext:Button ID="ButtonTestASCX" runat="server" Text="test ASCX" Icon="Accept" 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", "Hello ASCX").Show()
End Sub
End Class
When I run the code, appear two button.
If I click on first button, all OK... and the message will be showed.
If I click on second button... will display an error and the message will not be shown.
Can you help me?
Tnx!
Last edited by Daniil; Nov 13, 2014 at 4:08 PM.
Reason: [CLOSED]