1 Replies - 881 Views - Last Post: 18 August 2011 - 08:34 AM Rate Topic: -----

#1 Moogoo  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 82
  • Joined: 06-January 10

css image not rendering after SelectedIndex event

Posted 18 August 2011 - 07:25 AM

I am having a strange problem where my background image won't render after changing my selected index on a drop down list. I'm using Panels for each item in the drop down list and depending upon which item is selected, the corresponding Panel is visible and the rest are not visible. Everything works fine when I select the first item. When I select the blank option at the top, it's not showing the parchment background and it looks like it's trying to load the page forever. Here is my markup, and it's inheriting a master page:

(Master Page first):
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Menu.master.cs" Inherits="KaysCakes.Master.Menu" %>

<!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>Kays Cakery</title>
    <link href="~/Styles/Content.css" rel="stylesheet" type="text/css" />
    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="smMain" runat="server">
    </asp:ScriptManager>
    <div class="main">
        <asp:ContentPlaceHolder ID="cphMainBody" runat="server">
        
        </asp:ContentPlaceHolder>
    </div>
    </form>
</body>
</html>


(ASPX Page)
<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Master/Menu.Master" CodeBehind="Administration.aspx.cs" Inherits="KaysCakes.Administration" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="head">
    
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="cphMainBody">
    <asp:Panel ID="pnlAdminChoice" runat="server">
        <asp:DropDownList ID="ddlAdminChoices" runat="server" DataValueField = "ID" 
            DataTextField="TableName" AutoPostBack="true" 
            onselectedindexchanged="ddlAdminChoices_SelectedIndexChanged">
        </asp:DropDownList>
    </asp:Panel>
    <asp:Panel ID="pnlCategory" runat="server">
    category
    </asp:Panel>
    <asp:Panel ID="pnlCity" runat="server">
    city
    </asp:Panel>
    <asp:Panel ID="pnlDelivery" runat="server">
    delivery
    </asp:Panel>
    <asp:Panel ID="pnlFilling" runat="server">
    filling
    </asp:Panel>
    <asp:Panel ID="pnlIcing" runat="server">
    icing
    </asp:Panel>
    <asp:Panel ID="pnlMember" runat="server">
    member
    </asp:Panel>
    <asp:Panel ID="pnlMemberType" runat="server">
    memberType
    </asp:Panel>
    <asp:Panel ID="pnlOccassion" runat="server">
    occassion
    </asp:Panel>
    <asp:Panel ID="pnlOrder" runat="server">
    order
    </asp:Panel>
    <asp:Panel ID="pnlPayment" runat="server">
    payment
    </asp:Panel>
    <asp:Panel ID="pnlProduct" runat="server">
    product
    </asp:Panel>
    <asp:Panel ID="pnlStatus" runat="server">
    status
    </asp:Panel>
</asp:Content>




Also here is my code behind file:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace KaysCakes
{
    public partial class Administration : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            ddlAdminChoices.SelectedIndexChanged += new EventHandler(ddlAdminChoices_SelectedIndexChanged);
            if (!Page.IsPostBack)
            {
                HideAllPanels();
                FillAdminListDDL();
                ddlAdminChoices.Items.Insert(0, new ListItem("", "-1"));
            }            
        }

        private void FillAdminListDDL()
        {
            List<KaysCakes.Contracts.Data.TableDto> list = new List<Contracts.Data.TableDto>();
            KaysCakesClasses.Searcher searcher = new KaysCakesClasses.Searcher();
            list = searcher.GetAllTables();
            ddlAdminChoices.DataSource = list;
            ddlAdminChoices.DataBind();
        }

        private void HideAllPanels()
        {
            this.pnlCategory.Visible = false;
            this.pnlCity.Visible = false;
            this.pnlDelivery.Visible = false;
            this.pnlFilling.Visible = false;
            this.pnlIcing.Visible = false;
            this.pnlMember.Visible = false;
            this.pnlMemberType.Visible = false;
            this.pnlOccassion.Visible = false;
            this.pnlOrder.Visible = false;
            this.pnlPayment.Visible = false;
            this.pnlProduct.Visible = false;
            this.pnlStatus.Visible = false;
        }

        protected void ddlAdminChoices_SelectedIndexChanged(object sender, EventArgs e)
        {
            HideAllPanels();

            if (this.ddlAdminChoices.SelectedValue == "1")
            {
                pnlCategory.Visible = true;
            }
        }
    }
}



And finally, here is my CSS in question:
.main
{
    width:960px;
    margin-left: auto;
    margin-right: auto;
    margin-top: -5px;      
    min-height: 525px;
    background: url(../Images/parchmentbase.jpg);
}



Any ideas?

Is This A Good Question/Topic? 0
  • +

Replies To: css image not rendering after SelectedIndex event

#2 Moogoo  Icon User is offline

  • D.I.C Head
  • member icon

Reputation: 10
  • View blog
  • Posts: 82
  • Joined: 06-January 10

Re: css image not rendering after SelectedIndex event

Posted 18 August 2011 - 08:34 AM

I know this is a tricky one, I've had three developers on my team look at this with me, and the Google Admin isn't bringing up any references to this, so any help that I could get would be appreciated.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1