CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

MS SQL 2008 on ASP.NET Hosting



Zone: > NEWSGROUP > Asp.Net Forum > starter_kits_and_source_projects.commerce_starter_kit Tags:
Item Type: NewsGroup Date Entered: 9/11/2006 7:52:25 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 2 Views: 75 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
3 Items, 1 Pages 1 |< << Go >> >|
Paul44
Asp.Net User
Referencing Master Page - Tab like <li><a href9/11/2006 7:52:25 PM

0/0

I am trying to modify the Commerce Starter Kit using C#.  The Commerce Starter Kit comes with a Master Page that comtains controls as follows:

======================================================================================================== 

<><%@ Master Language="C#" AutoEventWireup="true" CodeFile="site.master.cs" Inherits="site" %>
<!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 id="Head1" runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <link id="Link1" rel="stylesheet" type="text/css" href='js/modal/subModal.css' runat="server" />
    <meta name="description" content="Description here" />
    <meta name="keywords" content="Keywords here"  />
    <title></title>
 </head>
<body>
<script src="<%=Page.ResolveUrl("~/js/effects/prototype.js") %>" type="text/javascript"></script>
<script src="<%=Page.ResolveUrl("~/js/effects/scriptaculous.js") %>" type="text/javascript"></script>
<form id="elForm" runat="server">
    <div id="header">
        <div id="logo">
            <a href="<%=Page.ResolveUrl("~/default.aspx")%>"><img src="<%=Page.ResolveUrl("~/images/csklogo.gif")%>" alt="Your Logo Here"/></a>
        </div>
        <div id="menu1">     
            <asp:LoginView ID="LoginView1" runat="server">
                <AnonymousTemplate>
                    <ul>
                        <li class="first"><a href="<%=Page.ResolveUrl("~/basket.aspx")%>"><img src="<%=Page.ResolveUrl("~/images/icons/cart.gif")%>"  align="absmiddle" alt=""/> My Cart <%if(ShowBasket()){%>(<%=this.GetItemCount()%>)<%} %></a></li>
                        <li><a href="<%=Page.ResolveUrl("~/login.aspx") %>">Log In</a></li>
                        <li><a href="<%=Page.ResolveUrl("~/login.aspx") %>">Register</a></li>
                    </ul>               
                </AnonymousTemplate>
                <LoggedInTemplate>
                <ul>
                    <li class="first">Welcome Back <%=Page.User.Identity.Name %>!</li>
                    <li><a href="<%=Page.ResolveUrl("~/basket.aspx")%>"><img src="<%=Page.ResolveUrl("~/images/icons/cart.gif")%>"
                                              align="absmiddle" alt=""/> My Cart <%if (ShowBasket())
                                              {%>(<%=this.GetItemCount()%>)<%} %></a></li>
                    <li><a href="<%=Page.ResolveUrl("~/myorders.aspx")%>">My Orders</a></li>
                    <li><asp:LinkButton ID="lnkLogout" CausesValidation="false" runat="server" Text="Log out" OnClick="lnkLogout_Click"></asp:LinkButton></li>
                </ul>            
                </LoggedInTemplate>          
            </asp:LoginView>
        </div>
        <div id="mainmenu">
            <ul>
  <li>
                <li><a href="<%=Page.ResolveUrl("~/default.aspx")%>" id="tab_Home" class="selected">Home</a></li>
                <li><a href="http://forums.asp.net/AddPost.aspx?ForumID=139#" id="tab_Services">Services</a></li>
                <li><a href="http://forums.asp.net/AddPost.aspx?ForumID=139#" id="tab_Contact">Contact</a></li>
                <li><a href="<%=Page.ResolveUrl("~/About.aspx")%>" id="tab_About">About</a></li>
                <li><a href="<%=Page.ResolveUrl("~/AboutSelected.aspx")%>" id="tab_AboutSelected" class="selected">AboutSelected</a></li>
                <%if(Page.User.IsInRole("Administrator")){ %>
                <li><a href="<%=Page.ResolveUrl("~/admin") %>" id="tab_Admin">Admin</a></li>
                <%} %>
            </ul>
        </div>
    </div>
    <div id="bar">
        <div id="searchbar">
            Search:
            <input type="text" name="txtSearch" /><a href="http://forums.asp.net/AddPost.aspx?ForumID=139#" onclick="location.href='<%=Page.ResolveUrl("~/search.aspx")%>?q='+document.forms[0].txtSearch.value">
            <asp:Image ID="btnSearch" runat="server" SkinID="doSearch" ImageAlign="AbsMiddle" /></a>
        </div>
    </div>
    <asp:contentplaceholder  id="ContentPlaceHolder1" runat="server">
    </asp:contentplaceholder>
    <!--#INCLUDE File=includes/modal_divs.aspx-->
</form>
</body>
</html>
<script type="text/javascript">
function popItScroll(theLink){
    window.open(theLink,null,'height=800,width=700,scrollbars=yes,resizable=yes');
}
function showIt(theBox){
    if(theBox.style.display==""){
        theBox.style.display="none";
    }else{
        theBox.style.display="";
    }
}
function toggleIt(theBox){
    if(theBox.style.display=="none"){
        new Effect.Appear(theBox);
    }else{
        new Effect.Fade(theBox);
    }
}
</script>

<>========================================================================================================

The <li> 's in the <div id = mainmenu>  now contain a   <li><a href= ~~~~~~~ id="tab_Home"   that I added.

I can find examples that show how to change the Text for a Label control on a Master Page -but- I can't find how to address the  class  atribute from the Master Page for a href.....  When the About tab is clicked in the PageLoad of the About page I am trying to set the  class="selected" of the tab_Home to  class = ""   and then set the  class="selected" for the tab_About.  All that I am trying to do is to shift the Highlight from the tab_Home tab to the tab_About tab.....  This seems to me to be a simple thing that everyone using tabs would want to do ?

I guess that the real question is:

I have found examples like        ((Label)Master.FindControl("Label1")).Text = TextBox1.Text;

-but- this is a Label - - - how can I do a FindControl for a     <li><a href     ???

Can someone please help on this issue ?

Thanks in advance,

Paul

 

stemyers
Asp.Net User
Re: Referencing Master Page - Tab like <li><a href9/28/2006 1:24:19 PM

0/0

 Hiya,

 Your li's and href's are not server controls, you can only reference server controls in the c# code.

 You have 2 choices, you can either turn your a link tags into server controls by adding the runat="server" attribute and obtaining a reference to the control as follows:

 HtmlAnchor tab_Home = MasterDetail.FindControl("tab_Home") as HtmlAnchor;
 Or you can replace the link tags with <asp:HyperLink> server controls as follows

<asp:HyperLink NavigateUrl="<%=Page.ResolveUrl("~/About.aspx")%>" ID="tab_About" runat="server">About</asp:HyperLink>

 and reference these controls in the c# code as: 

HyperLink tab_Home = MasterDetail.FindControl("tab_Home") as HyperLink;
 Hope this answers your question

 Stephen

 
Paul44
Asp.Net User
Re: Referencing Master Page - Tab like <li><a href9/28/2006 2:37:17 PM

0/0

NOW - this is what I call an answer (examples and all) - Thank you Stephen...

I had found that if I defined the links as HyperLink(s) like:

 <asp:HyperLink ID="HyperLink_Home" CssClass="selected" Text="Home" NavigateURL = "~/default.aspx" runat="server"></asp:HyperLink>

Then I could reference them like:

HyperLink hyperHome = (HyperLink).Master.FindControl("HyperLink_Home");

if (hyperHome != null)

{

    hyperHome.CssClass="";

}

I don't really like this hard codeed approach -but- :)  It works...

We should probably set up some kind of loop that would look through the Tabs and un-select 'all' of them - then set the 'current' Tab to selected.  That would be a lot cleaner for a generic Kit.

Thanks again Stephen,

Paul

 

3 Items, 1 Pages 1 |< << Go >> >|


Free Download:


Web:
Referencing Master Page - Tab like
  • Re: Referencing Master Page - Tab like
  • How to acces control from masterpage - ASP.NET Forums
  • " ... when another tab is clicked I would like to know how to set the Master Page "class" ...
    Master Pages Master Pages. M. aster Pages are like Dynamic Web Templates (DWTs) with a couple of major ....
  • exercises
  • ...
    ID Your Body For Greater CSS Control and Specificity - CSS-Tricks NET master pages). Having said that, it’s only a little more work for them to get .... page, like this:
  • Link 1
  • ...
    Felix Colibri- Asp.Net 2.0 Master Pages Oct 20, 2007 ... MASTER page tab, and paste the DIV after the FORM tag .... replace the STYLE attributes with a CLASS attribute referencing our .CSS markers. ...
    Nice CSS tab menu with PHP | Code.TechInterviews.com
  • Tab 2
  • ... Oracle: disable all constraints referencing the table · Oracle: info about the corrupted ...
    Horizontal Navigation - SitePoint Forums
  • Email List
  • ...
    plope - Using Zope Page Templates See Appendix C, Zope Page Templates Reference, for more information on TAL. ..... via the Test tab. You will see a table that looks much like the below: ...
    Help:User style - Wikinews, the free news source To make changes applicable on all projects, edit the master page; .... change colour of selected tabs */ #p-cactions ul li.selected a { background: white; ...




    Search This Site:










    error! how can i solve that ?

    to modify register.ascx

    directory listing

    magic redirect and query strings

    upgrade problem 1.0.10e to 2.1.2

    flicker problem on menu items

    memberrole.dll and probleme paging

    server error in '/dotnetnuke' application

    looking for a calendar module

    anyone done this-do sugg-proceeding for a case for viewing files in the content page

    remote install

    making a case for dnn - corporate use

    skin competition

    windows auth automatic login?

    dnn 3.1 how to hide top design icons bar in edit mode?

    error with sendmail after upgrading to dnn 3.2

    why is this construct not working?

    3.0.12 wysiwyg is not available.

    how to secure dnn email?

    cmdwizard is already used by another control

    prepending of relative paths

    dnn 4 with sql 2000

    hosting provider recommendations (dnn)?

    upload is currently unavailable!!!!! (more skin issue)

    3.0.13 issues: file manager

    no web.config in dnn 3.1 download

    register and login

    dnn 4.0 on sql 2000?

    4.0 installation issue: an unhandled error has occured.

    banner styling

      Privacy | Contact Us
    All Times Are GMT