B
Bon
Dear all
I create a master page with image buttons on the left-hand side for
navigation. When a user clicks the student button, the content (i.e.
ContentPlaceholder) in masterpage will be changed from default.aspx to
students.aspx.
I tried to create a subroutine in MasterPage.master.vb to do it. The
code is as following. But, the default.aspx's content is shown in
MasterPage even I clicked the student button.
How can I do that? Please give me some advices.
Here is my code:
MasterPage
=========
<html>
<body>
<form id="MasterForm" runat="server">
<table width="100%" border="0" cellpadding="0" cellspacing="0"
background="images/sidenavbg.gif">
<tr>
<td>
<asp:ImageButton runat="server" ImageUrl="~/Images/btn_students.gif"
width="183" height="26" id="btn_home" />
</td>
</tr>
....
</form>
</body>
</html>
MasterPage.master.vb
================
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Sub btn_students_click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs)
'Me.btn_students.Attributes.Add("onclick",
"this.src='students.aspx';")
End Sub
End Class
students.aspx
==========
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master"
AutoEventWireup="false" CodeFile="students.aspx.vb" Inherits="students"
title="testing" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<p> This is student page</p>
</asp:Content>
Thank you
Bon
I create a master page with image buttons on the left-hand side for
navigation. When a user clicks the student button, the content (i.e.
ContentPlaceholder) in masterpage will be changed from default.aspx to
students.aspx.
I tried to create a subroutine in MasterPage.master.vb to do it. The
code is as following. But, the default.aspx's content is shown in
MasterPage even I clicked the student button.
How can I do that? Please give me some advices.
Here is my code:
MasterPage
=========
<html>
<body>
<form id="MasterForm" runat="server">
<table width="100%" border="0" cellpadding="0" cellspacing="0"
background="images/sidenavbg.gif">
<tr>
<td>
<asp:ImageButton runat="server" ImageUrl="~/Images/btn_students.gif"
width="183" height="26" id="btn_home" />
</td>
</tr>
....
</form>
</body>
</html>
MasterPage.master.vb
================
Partial Class MasterPage
Inherits System.Web.UI.MasterPage
Sub btn_students_click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs)
'Me.btn_students.Attributes.Add("onclick",
"this.src='students.aspx';")
End Sub
End Class
students.aspx
==========
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master"
AutoEventWireup="false" CodeFile="students.aspx.vb" Inherits="students"
title="testing" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
<p> This is student page</p>
</asp:Content>
Thank you
Bon