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. storing text of textboxes in list ang show them in textbox again(in gridview)

storing text of textboxes in list ang show them in textbox again(in gridview)

Scheduled Pinned Locked Moved ASP.NET
tutorial
4 Posts 3 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
    strawberrysh
    wrote on last edited by
    #1

    I have a gridview that has a column of textbox that users input something in textbox.I want to retrieve text of textboes after postback,so i wrote this code to store texts of textboxes in list and list in a session.but I don't know how to show them agian in textboxes. my code to store text of textboxes:

    protected void Button1_Click(object sender, EventArgs e)
    {
    List qy = new List();
    foreach (GridViewRow gvr in GridView1.Rows)
    {
    TextBox q = (TextBox)gvr.FindControl("textbox5");
    if (Session["quantity"] == null)
    {
    qy.Add(q.Text.Trim());
    Session["quantity"] = qy;
    }
    else
    {
    ((List)Session["quantity"]).Add(q.Text.Trim());
    }
    }

    ----------------------------- and in pageloade i wrote this but I don't know how to continue it:

            if(Session\["quantity"\]!=null)
            {
                List temp=(List)Session\["quantity"\];
                foreach(GridViewRow gvr in GridView1.Rows)
                {
                    TextBox tq=(TextBox)gvr.FindControl("textbox5");
    
    B G 2 Replies Last reply
    0
    • S strawberrysh

      I have a gridview that has a column of textbox that users input something in textbox.I want to retrieve text of textboes after postback,so i wrote this code to store texts of textboxes in list and list in a session.but I don't know how to show them agian in textboxes. my code to store text of textboxes:

      protected void Button1_Click(object sender, EventArgs e)
      {
      List qy = new List();
      foreach (GridViewRow gvr in GridView1.Rows)
      {
      TextBox q = (TextBox)gvr.FindControl("textbox5");
      if (Session["quantity"] == null)
      {
      qy.Add(q.Text.Trim());
      Session["quantity"] = qy;
      }
      else
      {
      ((List)Session["quantity"]).Add(q.Text.Trim());
      }
      }

      ----------------------------- and in pageloade i wrote this but I don't know how to continue it:

              if(Session\["quantity"\]!=null)
              {
                  List temp=(List)Session\["quantity"\];
                  foreach(GridViewRow gvr in GridView1.Rows)
                  {
                      TextBox tq=(TextBox)gvr.FindControl("textbox5");
      
      B Offline
      B Offline
      Bassam Saoud
      wrote on last edited by
      #2

      You can use the Grd Row Created Event

      1 Reply Last reply
      0
      • S strawberrysh

        I have a gridview that has a column of textbox that users input something in textbox.I want to retrieve text of textboes after postback,so i wrote this code to store texts of textboxes in list and list in a session.but I don't know how to show them agian in textboxes. my code to store text of textboxes:

        protected void Button1_Click(object sender, EventArgs e)
        {
        List qy = new List();
        foreach (GridViewRow gvr in GridView1.Rows)
        {
        TextBox q = (TextBox)gvr.FindControl("textbox5");
        if (Session["quantity"] == null)
        {
        qy.Add(q.Text.Trim());
        Session["quantity"] = qy;
        }
        else
        {
        ((List)Session["quantity"]).Add(q.Text.Trim());
        }
        }

        ----------------------------- and in pageloade i wrote this but I don't know how to continue it:

                if(Session\["quantity"\]!=null)
                {
                    List temp=(List)Session\["quantity"\];
                    foreach(GridViewRow gvr in GridView1.Rows)
                    {
                        TextBox tq=(TextBox)gvr.FindControl("textbox5");
        
        G Offline
        G Offline
        goradaranaresh
        wrote on last edited by
        #3

        Just true the EnableViewState property of textvox or your grid.

        S 1 Reply Last reply
        0
        • G goradaranaresh

          Just true the EnableViewState property of textvox or your grid.

          S Offline
          S Offline
          strawberrysh
          wrote on last edited by
          #4

          the viewstates are true.I want to show text in textboxes agian after postback.

          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