Welcome to RenEvo Sign in | Join | Help
in
Home Wiisis Blogs Forums Photos Downloads About

Newbie ASP.NET Question

Last post 03-15-2007, 11:45 AM by Cypher. 3 replies.
Sort Posts: Previous Next
  •  02-07-2007, 8:06 AM 705

    Newbie ASP.NET Question

    Hey, I have a newbie question in ASP.NET.

    I'm making a menu on the top of the page to get to the various site sections, like this site.

    But I want to make the control be able to read the URL and based on that know where it's at and accordingly change the appearance of the suitable button.

  •  03-14-2007, 10:11 AM 888 in reply to 705

    Re: Newbie ASP.NET Question

    did you get anywhere with this?  if so, can you post your resolution.

    I am not familiar enough with the environment or method you are using a menu to be able to post a good answer.


    Advertising has us chasing cars and clothes, working jobs we hate so we can buy shit we don't need.
  •  03-15-2007, 10:45 AM 892 in reply to 888

    Re: Newbie ASP.NET Question

    Ummm... no.

    The Menu control is not suitable for me. Not in this capacity anyway.

    Instead, I did it with a custom control based on a horizontal list of anchors and labels. With the Page_Load of the custom control checking the location of the page and then, accordingly (Select Case) assignes the proper attributes to the coresponding menu "button".

    Though, I wanted to do it, instead of using Select Case, with a loop of items inside the panel - didn't quite work out.

     

    <script runat="server">

    Sub Page_Load()

    Dim strPath As String = Request.ServerVariables("URL")

    Dim a() As String

     

     

    a = strPath.Split("/")

     

     

    dskILS.BackColor = Drawing.Color.Transparent

    dskTkna.BackColor = Drawing.Color.Transparent

    dskOl.BackColor = Drawing.Color.Transparent

    dskMain.BackColor = Drawing.Color.Transparent

    dskLog.BackColor = Drawing.Color.Transparent

    dskZiud.BackColor = Drawing.Color.Transparent

    dskKnl.BackColor = Drawing.Color.Transparent

     

     

    Select Case a(2)

    Case "ILS" : dskILS.BackColor = Drawing.Color.Ivory

    Case "default.aspx" : dskMain.BackColor = Drawing.Color.Ivory

    Case "תקינה והפעלה" : dskTkna.BackColor = Drawing.Color.Ivory

    Case "ארגון ולוגיסטיקה" : dskOl.BackColor = Drawing.Color.Ivory

    Case "לוגיסטיקה ייעודית" : dskLog.BackColor = Drawing.Color.Ivory

    Case "ציוד כללי" : dskZiud.BackColor = Drawing.Color.Ivory

    Case "ניהול מספן" : dskKnl.BackColor = Drawing.Color.Ivory

     

    End Select

     

    End Sub

     

    </script>

     

     

    <div id="top1">

    <div style="text-align:right">

    <img alt="ענף לוגיסטיקה" src="/taba_web/images/title.gif" />

    </div>

     

    <asp:Panel ID="TopMenu" Direction="righttoleft" runat="server">

     

    <a href="/Taba_Web/ציוד כללי/"><asp:Label BorderColor="black" BorderWidth="2px" Width="100px" ID="dskZiud" Text="ציוד כללי" ToolTip="ציוד כללי" runat="server" style="cursor: hand" /></a>

    <a href="/Taba_Web/לוגיסטיקה ייעודית/"><asp:Label BorderColor="black" BorderWidth="2px" Width="100px" ID="dskLog" Text="לוגיסטיקה ייעודית" ToolTip="לוגיסטיקה ייעודית" runat="server" style="cursor: hand" /></a>

    <a href="/Taba_Web/ניהול מספן/"><asp:Label BorderColor="black" BorderWidth="2px" Width="100px" ID="dskKnl" Text="ניהול המספן" ToolTip="ניהול מספן" runat="server" style="cursor: hand" /></a>

    <a href="/Taba_Web/"><asp:Label BorderColor="black" BorderWidth="2px" Width="100px" ID="dskMain" Text="הענף" ToolTip="" runat="server" style="cursor: hand" /></a>

    <a href="/Taba_Web/ארגון ולוגיסטיקה/"><asp:Label BorderColor="black" BorderWidth="2px" Width="100px" ID="dskOl" Text="ארגון ולוגיסטיקה" ToolTip="ארגון ולוגיסטיקה" runat="server" style="cursor: hand" /></a>

    <a href="/Taba_Web/ILS/"><asp:Label BorderColor="black" BorderWidth="2px" Width="100px" ID="dskILS" Text="ILS" ToolTip="ILS" runat="server" style="cursor: hand" /></a>

    <a href="/Taba_Web/תקינה והפעלה/"><asp:Label BorderColor="black" BorderWidth="2px" Width="100px" ID="dskTkna" Text="תקינה והפעלה" ToolTip="תקינה והפעלה" runat="server" style="cursor: hand" /></a>

    <asp:Label ID="msg1" runat = "server" />

     

     

    </asp:Panel>

    </div>

  •  03-15-2007, 11:45 AM 894 in reply to 892

    Re: Newbie ASP.NET Question

    Instead, I want to make a loop in the server script.

    It will run through the label items inside the panel and compare the a(2) with the Label.Text or Label.ToolTip. If it's the same it will set the background color and border width to something like a pressed button, otherwise it will set background color and border width to something like unpressed button.

     

    But for some reason it won't work.
    Gives me that error I asked you about on MSN last week or so.

     

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems