Hi,
I am trying to fire a click event from a dymanically genertaed button to turn on a panel. Here is my code. Button shows up but when clicked nothing happens. Can someone please point me what am I doing wrong. Thanks! [CODE]
mypaneltest.aspx
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="mypaneltest.aspx.vb" Inherits="mypaneltest" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:scriptmanager ID="Scriptmanager1" runat="server"></asp:scriptmanager>
<asp:UpdatePanel ID="UpdatePanel2" UpdateMode="Conditional" runat="server" RenderMode="Inline">
<ContentTemplate>
<div>
<asp:Panel ID="pnlTest" Visible="false" runat="server">
TEST ME
</asp:Panel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="widget" runat="server"></div>
</form>
</body>
</html>
mypaneltest.aspx.vb:
Imports System
Imports System.Collections.Generic
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Text
Partial Class balli
Inherits System.Web.UI.Page
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim str As New StringBuilder()
str.Append("<div class=""btn-group"">" & vbLf)
str.Append("<asp:button id=""MyButton"" class=""btn " & " bigwindow"" runat=""server"" onClick=""MyButton_Click"" title=""Click to see panel" & """>Click Me</button>" & vbLf)
str.Append("</div>" & vbLf)
widget.InnerHtml = str.ToString()
End Sub
Protected Sub MyButton_Click(sender As Object, e As EventArgs)
MsgBox("TEST1")
Dim pnlTest As Panel = Me.Parent.FindControl("pnlTest")
pnlTest.Visible = True
End Sub
End Class [/CODE]