Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. ASP.Net 2 Menu Control and MultiView Control

ASP.Net 2 Menu Control and MultiView Control

Scheduled Pinned Locked Moved ASP.NET
helpcsharpasp-netdatabasevisual-studio
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    colin mcadam
    wrote on last edited by
    #1

    Hopefully somebody can help with this or at least tell me it is possible I have a VS 2005 project, the default page has a menu control, a multiview control and several views within this. When i click the menu item i use a case statement to make different views active, as shown; protected void mnuMain_MenuItemClick(object sender, MenuEventArgs e) { string strMenu = ""; strMenu = mnuMain.SelectedValue.ToString(); try { switch (strMenu) { case "Home": MultiView1.SetActiveView(viewHome); break; case "Submit": MultiView1.SetActiveView(viewSubmit); break; case "System": ds = dba.ReturnDataSet("select * from system_status"); grdSystem.DataSource = ds; grdSystem.DataBind(); MultiView1.SetActiveView(viewSystem); break; default: MultiView1.SetActiveView(viewHome); break; } } catch (Exception exp) { string exception = exp.ToString().Replace("\n", ""); Response.Redirect("error.aspx?error=" + exception); } } When the user clicks the menu item 'System' i want to connect to a database using a class i created called dba and the function ReturnDataSet. I then want to bind this to a gridview control called grdSystem, which is located in the View control 'System' and make this View the active view. This code complies and runs with no errors and the dataset has the correct number of rows returned. But the gridview inside the View is not displayed and on walking through the gridview has no items in it. (I tested with a gridView which was not inside a view and the contents as displayed ok so i think it is something to do with refreshing the view control??) Hopefully this makes sense and somebody can tell me if this is possible? Thanks Colin -- modified at 7:19 Tuesday 18th April, 2006

    M 1 Reply Last reply
    0
    • C colin mcadam

      Hopefully somebody can help with this or at least tell me it is possible I have a VS 2005 project, the default page has a menu control, a multiview control and several views within this. When i click the menu item i use a case statement to make different views active, as shown; protected void mnuMain_MenuItemClick(object sender, MenuEventArgs e) { string strMenu = ""; strMenu = mnuMain.SelectedValue.ToString(); try { switch (strMenu) { case "Home": MultiView1.SetActiveView(viewHome); break; case "Submit": MultiView1.SetActiveView(viewSubmit); break; case "System": ds = dba.ReturnDataSet("select * from system_status"); grdSystem.DataSource = ds; grdSystem.DataBind(); MultiView1.SetActiveView(viewSystem); break; default: MultiView1.SetActiveView(viewHome); break; } } catch (Exception exp) { string exception = exp.ToString().Replace("\n", ""); Response.Redirect("error.aspx?error=" + exception); } } When the user clicks the menu item 'System' i want to connect to a database using a class i created called dba and the function ReturnDataSet. I then want to bind this to a gridview control called grdSystem, which is located in the View control 'System' and make this View the active view. This code complies and runs with no errors and the dataset has the correct number of rows returned. But the gridview inside the View is not displayed and on walking through the gridview has no items in it. (I tested with a gridView which was not inside a view and the contents as displayed ok so i think it is something to do with refreshing the view control??) Hopefully this makes sense and somebody can tell me if this is possible? Thanks Colin -- modified at 7:19 Tuesday 18th April, 2006

      M Offline
      M Offline
      minhpc_bk
      wrote on last edited by
      #2

      Have you tried to place text or another simple control like Label along with the GridView in the System view and see if the active view is actually refreshed?

      C 1 Reply Last reply
      0
      • M minhpc_bk

        Have you tried to place text or another simple control like Label along with the GridView in the System view and see if the active view is actually refreshed?

        C Offline
        C Offline
        colin mcadam
        wrote on last edited by
        #3

        I can update the text propery of a label just after I do the bind and it shows the update. I can also add all the items in the dataSET to a dropdownlist and it shows. It is just the gridView which does not show the update - as if the bind has not worked. Thanks Colin

        M 1 Reply Last reply
        0
        • C colin mcadam

          I can update the text propery of a label just after I do the bind and it shows the update. I can also add all the items in the dataSET to a dropdownlist and it shows. It is just the gridView which does not show the update - as if the bind has not worked. Thanks Colin

          M Offline
          M Offline
          minhpc_bk
          wrote on last edited by
          #4

          Hmm, is there any chance that the Grid control is rebound somewhere else in the web page? Here on my machine, I simply have two view with one containing a GridView control, every time I switch to that view I can see the gridview control displayed.

          C 1 Reply Last reply
          0
          • M minhpc_bk

            Hmm, is there any chance that the Grid control is rebound somewhere else in the web page? Here on my machine, I simply have two view with one containing a GridView control, every time I switch to that view I can see the gridview control displayed.

            C Offline
            C Offline
            colin mcadam
            wrote on last edited by
            #5

            not sure what was going wrong but re-created the grid view and binding was succesfull GridView is displayed as expected Thanks Colin

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups