Hi ... (It is polite to include a name when seeking assistance),
In your main.aspx, you need to do two things: Get an instance of the SideMenu
control and its embedded button and add a handler for the button's click event.
The handler points to the code that will respond when the click event happens,
in this case it is Btn_Click().
The code below toggles the visibility of the datagrid on each click of the
button inside SideMenu.
Does this help?
Ken
MVP [ASP.NET]
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim usrSM As UserControl
Dim btnAddRecord As Button
usrSM = Page.FindControl("SIDEMENU1")
btnAddRecord = usrSM.FindControl("btnAddRecord")
AddHandler btnAddRecord.Click, AddressOf Btn_Click
End Sub
Private Sub Btn_Click _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs)
Dim usrCF As UserControl
usrCF = Page.FindControl("CustFields1")
usrCF.Visible = Not usrCF.Visible
End Sub
<%@ Control Language="vb" AutoEventWireup="false" Codebehind="SIDEMENU.ASCX.vb"
Inherits="p733workev.SideMenu1"
TargetSchema="
http://schemas.microsoft.com/intellisense/ie5" %>
<p>
<asp:label id="Label1" runat="server">This is SideMenu1</asp:label></p>
<p>
<asp:button id="btnAddRecord" runat="server" text="Add
Record"></asp:button></p>
<%@ Control Language="vb" AutoEventWireup="false"
Codebehind="CustFields.ascx.vb" Inherits="p733workev.CustFields"
TargetSchema="
http://schemas.microsoft.com/intellisense/ie5" %>
<asp:datagrid id="DataGrid1" runat="server"></asp:datagrid>
--
Microsoft MVPs have a question for *you*: Are you patched against the Worm?
http://www.microsoft.com/security/security_bulletins/ms03-026.asp
I have a web form named MAIN.ASPX with a three UserControls on it -
SideMenu1, CustFields1, and DGCust1.
I have set the visibility property for SideMenu1 and DGCust1 to False.
When the user clicks on a my "Add Record" button from SideMenu1, I
want the usercontrol CustFields1 to become visible.
In the SIDEMENU.ASCX file, I tried adding code TO the On Click event
for the "Add Record" button, to set the usercontrol in MAIN.ASCX to
true, but I can't get this to work.
Can someone give me an example on how to do something like this?
Thanks!