CodeVerge.Net Beta


   Explore    Item Entry    Members      Register  Login  
NEWSGROUP
.NET
Algorithms-Data Structures
Asp.Net
C Plus Plus
CSharp
Database
HTML
Javascript
Linq
Other
Regular Expressions
VB.Net
XML

Free Download:




Zone: > NEWSGROUP > Asp.Net Forum > general_asp.net.master_pages_themes_and_navigation_controls Tags:
Item Type: NewsGroup Date Entered: 4/3/2008 3:11:03 PM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 3 Views: 34 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
4 Items, 1 Pages 1 |< << Go >> >|
Loganix77
Asp.Net User
Find all DIV IDs on a Master Page4/3/2008 3:11:03 PM

0/0

Hey Gang!!

 I'm using a masterpage to control the layout and appearence of my site but I'm running into a small hang up.  I have an ASP menu that runs horizontal across the top of my master page.  When you select a category it takes you to /website/<CategoryName>/Defaults.aspx

On my master page I also have a collection of divs that run vertical on the right side.  Within each of these divs is the menu written in basic html for the category selected.  By default all divs are set as visible = false.  When you select your category the onload event checks the URL string and then I can set the appropriate div as visible.  Here is what I am currently doing:

If InStr(UCase((Request.ServerVariables("URL"))), "/SALES/") Then

SalesMenuDiv.Visible = True

Else

SalesMenuDiv.Visible = False

End If

What I would lIke to do is something like this but I just can't seem to figure it out and can't find any posts on google.  I'm sure there has to be something simple I'm over looking.

For each c as control in me.controls

Dim cTxt as String = c.ID

if inStr(cTxt, "MenuDiv") Then

if inStr(Ucase(URL), "/" & Replace(cTxt, "MenuDiv", "") & "/") Then

c.Visible = True

Else

c.Visible = False

End If

End If

 Right now I'm having to write out 10 if then statements and it works but I would rather have just one For Each statement.  Can someone point me in the right direction?

 Thanks!!!

 

 

anthonypj
Asp.Net User
Re: Find all DIV IDs on a Master Page4/3/2008 3:55:02 PM

0/0

why not wrap the individual html menu script in asp:panel's control instead of div's then you could use, i havent tested this but should work after soem tweaking.

<asp:panel id="RightPanel" runat="server" ....>

<asp:panel id="SalesMenu" ......>

   <ul>

    <li><a href="..... ></a></li>

   </ul>

</asp:panel>

<asp:panel id="CustomerMenu" .....>

   <ul>

    <li><a href="..... ></a></li>

   </ul>

</asp:panel>

 ...........

</asp:panel> 

 

 

For i = 0 To RightPanel.Controls.Count - 1

If RightPanel.Controls(i).GetType Is GetType(System.Web.UI.WebControls.Panel) Then

If CType(RightPanel.Controls(i), System.Web.UI.WebControls.Panel).ID = "YourValue" Then

CType(RightPanel.Controls(i), System.Web.UI.WebControls.Panel).Visible = True

Else

CType(RightPanel.Controls(i), System.Web.UI.WebControls.Panel).Visible = False

End If

End If

Next

you could also use master pages like so

<asp:contentplaceholder id="Rightmenu" runat="server">

</asp:contentplaceholder>

And insert the menu you wish to see on the page level

Loganix77
Asp.Net User
Re: Find all DIV IDs on a Master Page4/3/2008 5:55:21 PM

0/0

Great thought!

After 10 years of HTML and Classic ASP coding and only about 6 months of asp .net there are quite a few things that just don't click for me right away.  I've been using Div's for over 10 years the thought of using panels didn't even come to mind!!  Thanks for the kick in the right direction, I should be able to call the panel id's from a controls container!!

Thanks again!

anthonypj
Asp.Net User
Re: Find all DIV IDs on a Master Page4/3/2008 5:59:07 PM

0/0

For i = 0 To RightPanel.Controls.Count - 1

If RightPanel.Controls(i).GetType Is GetType(System.Web.UI.WebControls.Panel) Then

If CType(RightPanel.Controls(i), System.Web.UI.WebControls.Panel).ID = "YourValue" Then

CType(RightPanel.Controls(i), System.Web.UI.WebControls.Panel).Visible = True

Else

CType(RightPanel.Controls(i), System.Web.UI.WebControls.Panel).Visible = False

End If

End If

Next

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


Free Download:

Books:
ASP.NET 2.0 Website Programming: Problem-design-solution Authors: Marco Bellinaso, Pages: 576, Published: 2006
Real World SharePoint 2007: Indispensable Experiences from 16 MOSS and WSS MVPs Authors: Robert Bogue, Adam Buenz, Scot Hillier, Andrew Connell, Stacy Draper, Luis Du Solier Grinda, Todd Klindt, Jason Medero, Dustin Miller, Shane Perran, Joris Poelmans, Heather Solomon, Nick Swan, Jan Tielens, Mike Walsh, Shane Young, Pages: 504, Published: 2007
Beginning ASP.NET 3.5: In C# and VB Authors: Imar Spaanjaars, Pages: 734, Published: 2008
Beginning ASP.NET 2.0 with C# Authors: Chris Hart, John Kauffman, David Sussman, Chris Ullman, Pages: 735, Published: 2006
ASP.NET 2.0 Cookbook Authors: Michael A. Kittel, Geoffrey T. Leblond, Pages: 989, Published: 2005
Core Internet Application Development with ASP.NET 2.0 Authors: Randy Connolly, Pages: 1049, Published: 2007
Professional C# 2005 Authors: Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Allen Jones, Pages: 1540, Published: 2006
Professional C# 2005 with .NET 3.0 Authors: Christian Nagel, Bill Evjen, Jay Glynn, Karli Watson, Morgan Skinner, Pages: 1748, Published: 2007
Pro C# 2008 and the .NET 3.5 Platform Authors: Andrew Troelsen, Pages: 1370, Published: 2007
ASP.NET 2.0 Black Book: black book Authors: Dreamtech Software, Dreamtech Software, Charul Shukla, Anil Kumar Barnwal, Dreamtech Software India, Pages: 1167, Published: 2006

Web:
Find all DIV IDs on a Master Page - ASP.NET Forums NET Forums » General ASP.NET » Master Pages, Themes and Navigation Controls » Find all DIV IDs on a Master Page ... Re: Find all DIV IDs on a Master Page ...
Master pages and DIV width problem - ASP Free And in a webpage that uses the above master page, i have a
As a result the width of div#main is ...
NEED HELP!! Stuck on Master page - DevX.com Forums First time using Master pages. I can bring up each page individually ...
CodeSnip: Find Control in Nested Master Pages: ASP Alliance Oct 8, 2008 ... First of all, we should search about the content place holder of the outer master ... Listing 4: Find control inside nested master pages ...
How to: Create a Minimal Master Page This end tag corresponds to the ContentPlaceHolder with the id .... Find the < div> in your master page that wraps the content area of the page. ...
ASP.Net 2.0 - Master Pages: Tips, Tricks, and Traps Apr 11, 2006 ... In our simple setup, the master page will find a match for ......
...
pageLoad function in both masterpage and aspx page - ProgrammingTalk masterpage has this contant:. Code:.
< ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" ...
Master Pages That’s is all there is to creating a new empty Master Page! ■Caution ....




Search This Site:










portal reverts to admin skin randomly!

databinding property for textbox control

visual web developer 2008 data connection problem

msoft killing vb.net?

classbrowser for 3.0.4

security context for cache item expiration callback

getting "a critical error has occurred." with new custom module

'catastrophic failure' using aspnetwindowstokenroleprovider

recent worm patch killed dnn i'm guessing

run cgi application under integrated windows environment in iis 6.0

sponsers

general network error page

how to creat new page ,database and conection in clubstarterkit?

cls-compliant web controls?

cannot load type dotnetnuke.global

styling solpartmenu

skinning problems

what about rule based security?

problem with isonline property

converting treeview

hiding asp.net codebehind file's code from web hoster.

rsa problem

adding javascript in content page

help with tree view / site map

run a console exe from webpage

launching project in debug mode on vs2008 leaves ie hanging

how avoid to create/delete file within codebehind file

membership login

i need another (in addition to solpart) menu system

login loop

 
All Times Are GMT