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. GridView on MultiView / View with MenuItems to change Views - the problem

GridView on MultiView / View with MenuItems to change Views - the problem

Scheduled Pinned Locked Moved ASP.NET
databasehelpquestionannouncement
3 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.
  • M Offline
    M Offline
    Member 4700225
    wrote on last edited by
    #1

    "I am using MultiView / View controls which change by MenuItem clicks. Each view has a GridView on it with Edit and Insert features bound with <b>SqlDataSources</b> The problem is: when the edit button is clicked, the GridView disappears and you need to click on the MenuItem again to see it (it happens evrytime you click edit, update, cancel or insert buttons on the GridView)." Solution Suggested: In Page_load - if (!Page.IsPostBack){ //Getting the data from database //Bind the data to Gridview // Add this datasource to cache or session (e.g. Cache["mydata"]= dsProject.Table[0]; ) } else{ //Re-bind the gridview with datasource from cache. (e.g. GridView1.DataSource = (DataTable)Cache["mydata"] } <u>To Michael Sync:</u> Hi Michael - the problem is Im using SqlDataSources with the GridViews not DataSets. If I want to change them - it will be lot of changes. Any other suggestions? Thanks. Ekjon

    M 1 Reply Last reply
    0
    • M Member 4700225

      "I am using MultiView / View controls which change by MenuItem clicks. Each view has a GridView on it with Edit and Insert features bound with <b>SqlDataSources</b> The problem is: when the edit button is clicked, the GridView disappears and you need to click on the MenuItem again to see it (it happens evrytime you click edit, update, cancel or insert buttons on the GridView)." Solution Suggested: In Page_load - if (!Page.IsPostBack){ //Getting the data from database //Bind the data to Gridview // Add this datasource to cache or session (e.g. Cache["mydata"]= dsProject.Table[0]; ) } else{ //Re-bind the gridview with datasource from cache. (e.g. GridView1.DataSource = (DataTable)Cache["mydata"] } <u>To Michael Sync:</u> Hi Michael - the problem is Im using SqlDataSources with the GridViews not DataSets. If I want to change them - it will be lot of changes. Any other suggestions? Thanks. Ekjon

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      Member 4700225 wrote:

      To Michael Sync: Hi Michael - the problem is Im using SqlDataSources with the GridViews not DataSets. If I want to change them - it will be lot of changes. Any other suggestions?

      1. Can you check whether the GV got disappeared or not without using MultiView Control? Just want to make sure what the problem is. I think it will work. 2. If your gridview works okay without multiview, it might be MultiView1.SetActiveView problem. Can you check whether your the EnableViewState property of MultiView and the views which are in MultiView are true or not. (Ensure that you have checked each and every views.)

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

      M 1 Reply Last reply
      0
      • M Michael Sync

        Member 4700225 wrote:

        To Michael Sync: Hi Michael - the problem is Im using SqlDataSources with the GridViews not DataSets. If I want to change them - it will be lot of changes. Any other suggestions?

        1. Can you check whether the GV got disappeared or not without using MultiView Control? Just want to make sure what the problem is. I think it will work. 2. If your gridview works okay without multiview, it might be MultiView1.SetActiveView problem. Can you check whether your the EnableViewState property of MultiView and the views which are in MultiView are true or not. (Ensure that you have checked each and every views.)

        Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

        M Offline
        M Offline
        Member 4700225
        wrote on last edited by
        #3

        Hi Michael, In the MenuItems Click event handler, I did already set the ActiveViewIndex to the appropriate index depending on the MenuItem Click, so that should not be a problem. After I read your suggestions, I used SetActiveView instead of ActiveViewIndex. I did EnableViewState="true" for all of them, I even did EnableCaching="true" for the SqlDataSource. Everything works fine as they used to - Except the GridView disappears with edit, update, cancel, insert button clicks. You need to click on the MenuItem again to see it. I was also thinking that its happening because of the MultiViews. But interestingly, even if I move my GridView out of the MultiView, still does the same. What a puzzle!!! I am confident though that you can give me more clues! Thanks so much. Ekjon

        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