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. General Programming
  3. C#
  4. Saving dynamic content?

Saving dynamic content?

Scheduled Pinned Locked Moved C#
designquestionlearning
2 Posts 1 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.
  • S Offline
    S Offline
    Sled Dog
    wrote on last edited by
    #1

    Forum Folks, I cannot get my mind around the catch-22 I am in. I have added a text box to the page dynamically as expressed in the code below. The user may change the contents of that textbox. However, when the user clicks on the Save button, the page is rewritten and, of course, the textbox is rewritten: the content is gone. How do you save the content of a dynamic control before the page is rewritten? TIA, Sad Dog :sigh: //add the Filing Date td = new TableCell(); txt = new TextBox(); if (dr["Filing"] == DBNull.Value) { txt.Text = ""; } else { dtTemp = Convert.ToDateTime(dr["Due"]); txt.Text = dtTemp.ToShortDateString(); }; txt.Width = System.Web.UI.WebControls.Unit.Pixel(75); td.Controls.Add(txt); tr.Controls.Add(td);

    S 1 Reply Last reply
    0
    • S Sled Dog

      Forum Folks, I cannot get my mind around the catch-22 I am in. I have added a text box to the page dynamically as expressed in the code below. The user may change the contents of that textbox. However, when the user clicks on the Save button, the page is rewritten and, of course, the textbox is rewritten: the content is gone. How do you save the content of a dynamic control before the page is rewritten? TIA, Sad Dog :sigh: //add the Filing Date td = new TableCell(); txt = new TextBox(); if (dr["Filing"] == DBNull.Value) { txt.Text = ""; } else { dtTemp = Convert.ToDateTime(dr["Due"]); txt.Text = dtTemp.ToShortDateString(); }; txt.Width = System.Web.UI.WebControls.Unit.Pixel(75); td.Controls.Add(txt); tr.Controls.Add(td);

      S Offline
      S Offline
      Sled Dog
      wrote on last edited by
      #2

      And, I have "most" of the anwser... First, I created a User Control. Then, I created: public void Save_Content(). Next, I went back to the parent page where the control is placed. I created a Save button there. The click event does the following: private void btnSave_Click(object sender, System.EventArgs e) { m_oLIFTable.Save_Content(); } Also, I created a reference to the User Control where all my other controls are defined: protected LoanTrak.WebForms.Controls.LIFTable m_oLIFTable; The reason that I say "most" of the answer is because the page doesn't quite write the table of these dynamic date objects correctly. The first time through, as you chose a customer off of the parent page dropdown, the grid is filled out correctly. However, subsequent choices create the correct number of rows in this dynamic table, but the information from the previous choice is not completely cleared out. I will work on that...Unless, someone has an idea? Thanks. Sled Dog :~

      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