Need suggestion: How to process input for multiple rows in gridview

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cirene

    Need suggestion: How to process input for multiple rows in gridview

    I have a simple, 3 column, databound gridview that is laid out like this...
    QTY (textbox for input), PRODUCT, PRICING

    The user can input a quantity for 1 or more items in the gridview.

    When they hit submit how can I loop thru the gridview and check what they
    entered for QTY?

    I need to get a list like this....
    1, PRODUCT 1, $1.40
    4, PRODUCT 8, $10.47
    2, PRODUCT 10, $1.42

    Thanks!


  • amandag

    #2
    Re: Need suggestion: How to process input for multiple rows in gridview


    protected void btnSubmit_Click (object sender, EventArgs e)
    {
    TextBox t;
    foreach (GridViewRow grv in GridView1.Rows)
    {
    t = grv.FindControl s("yourTextBoxI d") as TextBox;
    if (t != null)
    {
    //t.Text
    }
    }
    }


    "Cirene" <cirene@nowhere .comдÈëÏûÏ¢
    news:%23wI503m% 23IHA.4476@TK2M SFTNGP05.phx.gb l...
    >I have a simple, 3 column, databound gridview that is laid out like this...
    QTY (textbox for input), PRODUCT, PRICING
    >
    The user can input a quantity for 1 or more items in the gridview.
    >
    When they hit submit how can I loop thru the gridview and check what they
    entered for QTY?
    >
    I need to get a list like this....
    1, PRODUCT 1, $1.40
    4, PRODUCT 8, $10.47
    2, PRODUCT 10, $1.42
    >
    Thanks!
    >

    Comment

    • Cirene

      #3
      Re: Need suggestion: How to process input for multiple rows in gridview

      Thanks I'll give it a try!
      "amandag" <amandag5577@ho tmail.comwrote in message
      news:uvvI6Dq%23 IHA.5192@TK2MSF TNGP04.phx.gbl. ..
      >
      protected void btnSubmit_Click (object sender, EventArgs e)
      {
      TextBox t;
      foreach (GridViewRow grv in GridView1.Rows)
      {
      t = grv.FindControl s("yourTextBoxI d") as TextBox;
      if (t != null)
      {
      //t.Text
      }
      }
      }
      >
      >
      "Cirene" <cirene@nowhere .comдÈëÏûÏ¢
      news:%23wI503m% 23IHA.4476@TK2M SFTNGP05.phx.gb l...
      >>I have a simple, 3 column, databound gridview that is laid out like
      >>this...
      > QTY (textbox for input), PRODUCT, PRICING
      >>
      >The user can input a quantity for 1 or more items in the gridview.
      >>
      >When they hit submit how can I loop thru the gridview and check what they
      >entered for QTY?
      >>
      >I need to get a list like this....
      > 1, PRODUCT 1, $1.40
      > 4, PRODUCT 8, $10.47
      > 2, PRODUCT 10, $1.42
      >>
      >Thanks!
      >>
      >
      >

      Comment

      Working...