Dynamic Template Column - retaining value on postback

Discussion in 'ASP .Net Web Controls' started by Etrast, Jun 17, 2004.

  1. Etrast

    Etrast Guest

    I am adding dynamic template columns to a datagrid. The template column contains a textbox which the user can edit. When I am rendering it initially, the text in the textbox is bound to a column in the dataset. Everything works fine till this point.

    After the user makes changes to the textbox and submits the page, I am creating the dynamic columns in page_load. The problem I am facing is that when creating the textbox again, I do not have the value that the user put in. Is there any way I can get the value put in by the user when I create the template column again on post back.


    All the articles I have read say the value of the textbox should be in the viewstate and should be assigned to the control when it is created again on postback.

    Any help will be greatly appreciated..
     
    Etrast, Jun 17, 2004
    #1
    1. Advertising

  2. Etrast

    Tim_k Guest

    Etrast,
    I have the same problem. This code finds the user entered value in a textbox within a grid. Then it updates the value(s) to the bound datatable. But the value does not display after rebinding to the grid. I think it has something to do with the binding of the textbox?
    Tim

    For Each dgitem In dgQuery.Items
    txt1 = CType(dgitem.FindControl("txtValues"), TextBox) 'Values textbox
    Session("dtTable1").Rows(dgitem.ItemIndex).Item("txtValues") = txt1
    Next

    drTemp = Session("dtTable1").Rows(rowNum)
    Session("dtTable1").Rows.Remove(drTemp)


    "Etrast" wrote:

    > I am adding dynamic template columns to a datagrid. The template column contains a textbox which the user can edit. When I am rendering it initially, the text in the textbox is bound to a column in the dataset. Everything works fine till this point.
    >
    > After the user makes changes to the textbox and submits the page, I am creating the dynamic columns in page_load. The problem I am facing is that when creating the textbox again, I do not have the value that the user put in. Is there any way I can get the value put in by the user when I create the template column again on post back.
    >
    >
    > All the articles I have read say the value of the textbox should be in the viewstate and should be assigned to the control when it is created again on postback.
    >
    > Any help will be greatly appreciated..
    >
    >
     
    Tim_k, Jun 30, 2004
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mirin
    Replies:
    1
    Views:
    899
    Mark Rae [MVP]
    Mar 3, 2008
  2. Karthikeyan
    Replies:
    1
    Views:
    344
  3. David Bowey
    Replies:
    2
    Views:
    233
    Nick Stansbury
    Apr 5, 2005
  4. Etrast

    Dynamic Template Column - retaining value on postback

    Etrast, Jun 17, 2004, in forum: ASP .Net Web Controls
    Replies:
    1
    Views:
    277
    Andy Z Smith
    Jun 17, 2004
  5. David Bowey
    Replies:
    2
    Views:
    219
    Nick Stansbury
    Apr 5, 2005
Loading...

Share This Page