Results 1 to 5 of 5

Thread: Issues w/Master Pages?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Issues w/Master Pages?

    I'm pretty new to web programming and I've been told that if this is what I want to do....I should use MP's and not Frames/IFrames. So, I'm trying to use them and finding it a little difficult. My understanding is that a MP can contain controls that appear whenever any other Content Pages are in view. So, I have added an asp:Menu control to my MP. Each menu item references a CP. What's weird is, when I click a menuItem, I retrieve a CP using the "Response.Redirect" command. However, even though it will load my CP, it will throw an unseen exception - "Unable to evaluate expression". Why is it doing that and even moreso, what's the correct way to call a CP?

    Thanks,
    Blake

  2. #2
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Issues w/Master Pages?

    Hello,

    Can you show the code that you are using?

    Bottom line is, you simply call the Content Page.

    Let's say you have Default.aspx, Login.aspx and Register.aspx. Each of these content pages references the Master Page (which you never actually call) and in doing that, each of them will show the Menu with is contained within the Master Pages markup.

    From there, you Menu items simply need to do a Response.Redirect to Default.aspx, Login.aspx and Register.aspx.

    Or, better still, don't do that code yourself. Create a web.sitemap file, and add a SiteMapDataSource to your page, and point the Menu Control at the SiteMapDataSource and it will handle it all for you.

    Gary

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jan 2004
    Location
    Southern California
    Posts
    5,034

    Re: Issues w/Master Pages?

    Gary,

    Here is the code that is in my MP. This is what controls calling my CP's.

    Code:
        Private Sub Menu1_MenuItemClick(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemClick
            Try
                Select Case e.Item.Value
                    Case "mnuCustomerMaintenance"
                        Response.Redirect("~/Customer/Customer.aspx")
                    Case "mnuViewCustomers"
                        Session("disableButtons") = True
                        Response.Redirect("~/Customer/Customer.aspx")
                    Case "mnuLookupTable"
                        Response.Redirect("~/Admin/LookUp.aspx")
                    Case "mnuEmployees"
                        Response.Redirect("~/Employee/Employee.aspx")
                    Case "mnuSystemSettings"
                    Case "mnuPrinterSetup"
                    Case "mnuPrint"
                    Case "mnuCustomerMaintenance"
                    Case "mnuViewCustomers"
                    Case "mnuInventoryMaintenance"
                        Response.Redirect("~/Inventory/Inventory.aspx")
                    Case "mnuViewInventory"
                        Response.Redirect("~/Inventory/Inventory.aspx")
                    Case "mnuReceiveInventory"
                    Case "mnuAdjustLevels"
                    Case "mnuVendorMaintenance"
                        Response.Redirect("~/Vendors/Vendors.aspx")
                    Case "mnuViewVendors"
                        Response.Redirect("~/Vendors/Vendors.aspx")
                    Case "mnuInvoiceMaintenance"
                        Response.Redirect("~/Invoicing/InvoiceMaintenance.aspx")
                    Case "mnuViewInvoices"
                    Case "mnuChangePassword"
                        Response.Redirect("~/Admin/ResetPassword.aspx")
                    Case "mnuPrintInvoices"
                    Case "mnuReportCustomerMasterListing"
                    Case "mnuInventoryMasterListing"
                    Case "mnuReportInventoryOutofStock"
                    Case "mnuReportInventoryPriceList"
                    Case "mnuReportVendorMasterListing"
                    Case "mnuReportINvoicingHistoryAging"
                    Case "mnuLogin"
                        Response.Redirect("~/Admin/SysLogin.aspx")
                End Select
    
            Catch ex As Exception
                lblMessage.Text = dbIO.DisplayError("Menu1_MenuItemClick()", "SiteMP", ex.Message)
            End Try
        End Sub
    Blake

  4. #4
    PowerPoster gep13's Avatar
    Join Date
    Nov 2004
    Location
    The Granite City
    Posts
    21,963

    Re: Issues w/Master Pages?

    Hey,

    Ah, ok, you are wrapped in a Try/Catch.

    Try using the second parameter of the Response.Redirect method:

    http://msdn.microsoft.com/en-us/library/a8wa7sdt.aspx

    Gary

  5. #5
    VB Addict Pradeep1210's Avatar
    Join Date
    Apr 2004
    Location
    Inside the CPU...
    Posts
    6,614

    Re: Issues w/Master Pages?

    Which line throws that error?
    Pradeep, Microsoft MVP (Visual Basic)
    Please appreciate posts that have helped you by clicking icon on the left of the post.
    "A problem well stated is a problem half solved." — Charles F. Kettering

    Read articles on My Blog101 LINQ SamplesJSON ValidatorXML Schema Validator"How Do I" videos on MSDNVB.NET and C# ComparisonGood Coding PracticesVBForums Reputation SaverString EnumSuper Simple Tetris Game


    (2010-2013)
    NB: I do not answer coding questions via PM. If you want my help, then make a post and PM me it's link. If I can help, trust me I will...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width