Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Dynamic Template Column - retaining value on postback

Reply
Thread Tools

Dynamic Template Column - retaining value on postback

 
 
Etrast
Guest
Posts: n/a
 
      06-17-2004
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..


 
Reply With Quote
 
 
 
 
Tim_k
Guest
Posts: n/a
 
      06-30-2004
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("t xtValues") = 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..
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Retaining the value of the variable across dynamic library Karthikeyan C Programming 1 12-11-2008 08:35 AM
Retaining dynamic controls on postback mirin ASP .Net 1 03-03-2008 12:53 PM
Adding a Dynamic User Control from the Base Page Class (and retaining it on Postback?) David Bowey ASP .Net Building Controls 2 04-05-2005 08:17 AM
Adding a Dynamic User Control from the Base Page Class (and retaining it on Postback?) David Bowey ASP .Net Web Controls 2 04-05-2005 08:17 AM
Dynamic Template Column - retaining value on postback Etrast ASP .Net Web Controls 1 06-17-2004 10:57 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57