Hi,
I am developing an application using multiview control. Everything is working perfectly. But i want to fix some images in multiview page. In that i have 4 views. If i am in view1 first image shold be highlighted.For that i am using code like this.
C#
if (!IsPostBack)
{
img1.Visible = false;
Img11.Visible = true;
img2.Visible = true;
Img22.Visible = false;
Img3.Visible = true;
Img33.Visible = false;
Img4.Visible = true;
Img44.Visible = false;
}CSS
When i went to view2 i have to change to another image. For that i am using following code in a button click. But it is always Enabling first image only.C#
img1.Visible = true;
Img11.Visible = false;
Img22.Style.Add("Hidden", "false");
img2.Visible = false;
Img22.Visible = true;
Img3.Visible = true;
Img33.Visible = false;
Img4.Visible = true;
Img44.Visible = false;Code
How to solve my problem. Anybody pls help me........Code
Regards,Code
Rajesh
Hemant KumarRank #1,202 · 1.5K reputationPosted Oct 2, 2011, 10:01 PM EDT
As a solution, I wrote a demo for your reference only, see the whole code:
Main.master:
@ Master Language="C#" %> !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> script runat="server"> public string home, services, takeatour; protected void Page_Load(object sender, EventArgs e) { System.IO.FileInfo fi = new System.IO.FileInfo(System.Web.HttpContext.Current.Request.Url.AbsolutePath); string currentPagename = fi.Name; Actived(currentPagename); } /// summary> /// Active page /// summary> /// param name="currentPagename">active current pageparam> void Actived(string currentPagename) { switch (currentPagename) { case "home.aspx": { home = "current_page_item"; services = ""; takeatour = ""; break; } case "service.aspx": { home = ""; services = "current_page_item"; takeatour = ""; break; } case "takeatour.aspx": { home = ""; services = ""; takeatour = "current_page_item"; break; } default: { home = "current_page_item"; services = ""; takeatour = ""; break; } } } script> html xmlns="http://www.w3.org/1999/xhtml"> head runat="server"> title>Demotitle> link href="css.css" rel="stylesheet" type="text/css" /> asp:ContentPlaceHolder ID="head" runat="server"> asp:ContentPlaceHolder> head> body> form id="form1" runat="server"> div> div id="menu"> ul> li class=" home %>">a href="home.aspx">Homea>li> li class=" services %>">a href="service.aspx">Servicesa>li> li class=" takeatour %>">a href="takeatour.aspx">Take a toura>li> ul> div> br /> br /> br /> br /> br /> asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server"> asp:ContentPlaceHolder> br /> div> form> body> html>@ Page Language="C#" MasterPageFile="~/main.master" Title="Home" %> script runat="server"> script> asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> asp:Content> asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> div> Home div> asp:Content>@ Page Language="C#" MasterPageFile="~/main.master" Title="Service" %> script runat="server"> script> asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> asp:Content> asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> div> Service div> asp:Content>Takeatour.aspx:@ Page Language="C#" MasterPageFile="~/main.master" Title="Take a tour" %> script runat="server"> script> asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"> asp:Content> asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> div> Take a tour div> asp:Content>#menu { float: left; width: 800px; height: 60px; background-color:Green; font-family: Arial, Helvetica, sans-serif; } #menu ul { margin: 0; padding: 0; list-style: none; line-height: normal; } #menu li { float: left; background-color:Green; height: 60px; padding: 0 15px 0 15px; } #menu a { display: block; float: left; height: 25px; margin-right: 1px; padding: 22px 20px 0 20px; text-decoration: none; text-transform: uppercase; font-size: 14px; font-weight: bold; color: #FFFFFF; } #menu a:hover { color: #2C2E22; } #menu .current_page_item a { color: #2C2E22; }Rajesh Muraharisetty34 reputationPosted Oct 2, 2011, 10:33 PM EDT
Regards,
Rajesh