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
helpquestionannouncement
4 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

    Thanks to Abisodun and Mike for answering my previous post. Both of the answers was directed to the 2nd part of my question. On the first part, I still need help. So - here's it again: I am using MultiView / View controls which change by MenuItem clicks. Each view has a GridView on it with Edit and Insert features. 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). Any ideas? Thanks. Ekjon

    M 1 Reply Last reply
    0
    • M Member 4700225

      Thanks to Abisodun and Mike for answering my previous post. Both of the answers was directed to the 2nd part of my question. On the first part, I still need help. So - here's it again: I am using MultiView / View controls which change by MenuItem clicks. Each view has a GridView on it with Edit and Insert features. 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). Any ideas? Thanks. Ekjon

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

      As I said in previous post, you might miss to bind the dataset in your pageload after postback... Can you show us what you wrote in PageLoad and Edit event?

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

      M 1 Reply Last reply
      0
      • M Michael Sync

        As I said in previous post, you might miss to bind the dataset in your pageload after postback... Can you show us what you wrote in PageLoad and Edit event?

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

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

        Hi Michael, Here's what I'm doing: for the common part of the page, I am using dataset to populate some textbox controls, then for the details part - I'm using GridViews with a SqlDataSources. Each of the GridViews are placed on a View control being changed by MenuItem clicks. Here are some code: protected void Page_Init(object sender, EventArgs e) { projectId = Convert.ToInt32(Session["ClickedId"]); string [] dataKeys = {"MethodSID"}; conn = new SqlConnection(); // Get the ConnectionString dynamically conn.ConnectionString = ConfigurationManager.ConnectionStrings["EEM-NEWConnectionString1"].ConnectionString; dsrcMethods.ConnectionString = conn.ConnectionString; Parameter param; dsrcMethods.UpdateCommand = "update tblMethod set MethodName=@MethodName, MethodDesc=@MethodDesc," + "TaxonomicalKeys=@TaxonomicalKeys, TaxonomicalDesc=@TaxonomicalDesc" + " where MethodSID=@MethodSID and ProjectID=" + projectId; dsrcMethods.InsertCommand = "insert into tblMethod (ProjectID, MethodName, MethodDesc, TaxonomicalKeys," + " TaxonomicalDesc) values (" + projectId + ",@MethodName,@MethodDesc," + " @TaxonomicalKeys,@TaxonomicalDesc)"; param = new Parameter("MethodSID", TypeCode.Int32); dsrcMethods.UpdateParameters.Add(param); param = new Parameter("MethodName", TypeCode.String); dsrcMethods.UpdateParameters.Add(param); dsrcMethods.InsertParameters.Add(param); param = new Parameter("MethodDesc", TypeCode.String); dsrcMethods.UpdateParameters.Add(param); dsrcMethods.InsertParameters.Add(param); param = new Parameter("TaxonomicalKeys", TypeCode.String); dsrcMethods.UpdateParameters.Add(param); dsrcMethods.InsertParameters.Add(param); param = new Parameter("TaxonomicalDesc", TypeCode.String); dsrcMethods.UpdateParameters.Add(param); dsrcMethods.InsertParameters.Add(param); gvMethods.DataKeyNames = dataKeys; gvMethods.DataSourceID = dsrcMethods.ID; } protected void Page_Load(object sender, EventArgs e) { txtID.Focus(); txtID.Enabled = false; txtTitle.Enabled = false; txtAbstract.Enabled = false; txtJust.Enabled = false; txtSponsor.Enabled = false; txtStart

        M 1 Reply Last reply
        0
        • M Member 4700225

          Hi Michael, Here's what I'm doing: for the common part of the page, I am using dataset to populate some textbox controls, then for the details part - I'm using GridViews with a SqlDataSources. Each of the GridViews are placed on a View control being changed by MenuItem clicks. Here are some code: protected void Page_Init(object sender, EventArgs e) { projectId = Convert.ToInt32(Session["ClickedId"]); string [] dataKeys = {"MethodSID"}; conn = new SqlConnection(); // Get the ConnectionString dynamically conn.ConnectionString = ConfigurationManager.ConnectionStrings["EEM-NEWConnectionString1"].ConnectionString; dsrcMethods.ConnectionString = conn.ConnectionString; Parameter param; dsrcMethods.UpdateCommand = "update tblMethod set MethodName=@MethodName, MethodDesc=@MethodDesc," + "TaxonomicalKeys=@TaxonomicalKeys, TaxonomicalDesc=@TaxonomicalDesc" + " where MethodSID=@MethodSID and ProjectID=" + projectId; dsrcMethods.InsertCommand = "insert into tblMethod (ProjectID, MethodName, MethodDesc, TaxonomicalKeys," + " TaxonomicalDesc) values (" + projectId + ",@MethodName,@MethodDesc," + " @TaxonomicalKeys,@TaxonomicalDesc)"; param = new Parameter("MethodSID", TypeCode.Int32); dsrcMethods.UpdateParameters.Add(param); param = new Parameter("MethodName", TypeCode.String); dsrcMethods.UpdateParameters.Add(param); dsrcMethods.InsertParameters.Add(param); param = new Parameter("MethodDesc", TypeCode.String); dsrcMethods.UpdateParameters.Add(param); dsrcMethods.InsertParameters.Add(param); param = new Parameter("TaxonomicalKeys", TypeCode.String); dsrcMethods.UpdateParameters.Add(param); dsrcMethods.InsertParameters.Add(param); param = new Parameter("TaxonomicalDesc", TypeCode.String); dsrcMethods.UpdateParameters.Add(param); dsrcMethods.InsertParameters.Add(param); gvMethods.DataKeyNames = dataKeys; gvMethods.DataSourceID = dsrcMethods.ID; } protected void Page_Load(object sender, EventArgs e) { txtID.Focus(); txtID.Enabled = false; txtTitle.Enabled = false; txtAbstract.Enabled = false; txtJust.Enabled = false; txtSponsor.Enabled = false; txtStart

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

          Try like that.. 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"];) }

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

          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