Ask a Question related to ASP.NET General, Design and Development.
-
Kelly #1
dynamic controls not updated
Hi Everyone
I have a web application and all it basically does is ask for a user
id and show a questionnaire. To create the questionnaire, I get the
list of questions from the database and dynamically add controls
(i.e,. labels, radiobuttons, textboxes) for each question. If the user
has visited the page before, I will go to the database and populate
the questionnaire with the answers that the user have entered before
and display it to the user and allow them to edit it.
Everytime the page loads, I will recreate the dynamic controls and
populate it with that user's information from the database. However
my problem is that even if there is a different user id entered, the
values for the dynamic controls stay the same even though I just
recreated them! So if I put in User1 for the user id, a questionnaire
will show up with User1's information from the database, but if I put
in User2 next for the user id, I get a questionnaire with User1's
information on it. Does anyone know why the values for the
dynamically created controls are not being updated?
I heard that it might help to set enableviewstate to false, but I
can't do that because I use request.form to get the values from those
dynamically created controls. Thanks in advance.
Kelly
Kelly Guest
-
Dynamic Controls
hi, Here's what I'm trying to do. A simple datagrid that is populated by a variable amount of data, which displays a different amount of rows. ... -
dynamic controls in asp.net....Please Help...
Hello People, I would appreciate your responses on this. I am writing an asp.net web-application involving C#. I am actually building a test... -
Dynamic Controls - Still!
Hi Jim Thanks for your help. I changed the table from an ASP.Net table to an HTML table. I am till having the problem of the control placed... -
Datagrid not updated during delete, but updated during insert and update
Hello everyone. A test webform here, single datagrid bound to one table through dataset, and controls to delete, update and insert data. The code... -
please help with dynamic user controls
Hi Suzanne I agree. If you ever want to add controls dynamically to a page and have them track their viewstate, you need to create them during... -
Natty Gur #2
Re: dynamic controls not updated
Hi,
is it possible that any caching is happaned ?
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Natty Gur #3
Re: dynamic controls not updated
try to set Response.Expires = -1. this will prevent your browser to get
a page from the cache.
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Kelly Lim #4
Re: dynamic controls not updated
That didn't work.
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Kelly Lim Guest
-
Natty Gur #5
Re: dynamic controls not updated
Let’s check it on simple project with one page and 2 dynamic controls.
Don’t copy from your existing project create new. It is still happening?
If so send the project source. if the new project works OK it might be
something in your code logic.
Natty Gur, CTO
Dao2Com Ltd.
28th Baruch Hirsch st. Bnei-Brak
Israel , 51114
Phone Numbers:
Office: +972-(0)3-5786668
Fax: +972-(0)3-5703475
Mobile: +972-(0)58-888377
Know the overall picture
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Natty Gur Guest
-
Kelly Lim #6
Re: dynamic controls not updated
Here is my code (After postback, I dynamically recreate the controls but
with some changes but the changes aren't reflected:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
Dim Radio1 As RadioButton
Dim Radio2 As RadioButton
Dim TextBox1 As TextBox
If Not Me.IsPostBack Then
TextBox1 = New TextBox()
TextBox1.ID = "myTestBox1"
TextBox1.Text = "Before postback"
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(TextBox1)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
Radio1 = New RadioButton()
Radio1.ID = "myRadio1"
Radio1.Text = "Red"
Radio1.GroupName = "Color"
Radio1.Checked = False
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(Radio1)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
Radio2 = New RadioButton()
Radio2.ID = "myRadio2"
Radio2.Text = "Blue"
Radio2.GroupName = "Color"
Radio2.Checked = False
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(Radio2)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
Else
TextBox1 = New TextBox()
TextBox1.ID = "myTestBox1"
TextBox1.Text = "After postback"
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(TextBox1)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
Radio1 = New RadioButton()
Radio1.ID = "myRadio1"
Radio1.Text = "Red"
Radio1.GroupName = "Color"
Radio1.Checked = True
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(Radio1)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
Radio2 = New RadioButton()
Radio2.ID = "myRadio2"
Radio2.Text = "Blue"
Radio2.GroupName = "Color"
Radio2.Checked = True
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(Radio2)
Me.FindControl("Form1").FindControl("plhTest").Con trols.Add(New
LiteralControl("<br>"))
End If
End Sub
*** Sent via Developersdex [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Kelly Lim Guest



Reply With Quote

