473,396 Members | 1,879 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Caching (?) problem with System.Web.UI.WebControls.Table ???

I am using a System.Web.UI.WebControls.Table control on a screen. (Dot Net
1.1)

My problem is this: The table is programmatically reconstructed on every
postback. Each table row contains two textboxes that are intially set from
the database. None of the items in the table are 'databound'. As of now, if
the previous instance of the screen contained data in the first row boxes,
that data is carried over, even if the boxes text value is cleared in code.
(I have traced through and the boxes are being cleared in code.) Ironically,
under other circumstances I depend on this same 'effect' to get entered data,
but in this case it is completely unwanted.

What is happening here and how can data be carried over in this fashion?
Apr 12 '06 #1
10 1885

You are right. In most situations, one would want this to happen. (i.e. one
would want the textboxes to be populated from the ViewState with the values
that the user entered which is considered the correct outcome)

If you simply want to discard the ViewState on those controls then set the
EnableViewState ="False" on those textboxes

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"B. Chernick" wrote:
I am using a System.Web.UI.WebControls.Table control on a screen. (Dot Net
1.1)

My problem is this: The table is programmatically reconstructed on every
postback. Each table row contains two textboxes that are intially set from
the database. None of the items in the table are 'databound'. As of now, if
the previous instance of the screen contained data in the first row boxes,
that data is carried over, even if the boxes text value is cleared in code.
(I have traced through and the boxes are being cleared in code.) Ironically,
under other circumstances I depend on this same 'effect' to get entered data,
but in this case it is completely unwanted.

What is happening here and how can data be carried over in this fashion?

Apr 12 '06 #2
Well that's the problem. I don't want to get rid of the viewstate. I need
it... part of the time. How do I control this?

"Phillip Williams" wrote:

You are right. In most situations, one would want this to happen. (i.e. one
would want the textboxes to be populated from the ViewState with the values
that the user entered which is considered the correct outcome)

If you simply want to discard the ViewState on those controls then set the
EnableViewState ="False" on those textboxes

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"B. Chernick" wrote:
I am using a System.Web.UI.WebControls.Table control on a screen. (Dot Net
1.1)

My problem is this: The table is programmatically reconstructed on every
postback. Each table row contains two textboxes that are intially set from
the database. None of the items in the table are 'databound'. As of now, if
the previous instance of the screen contained data in the first row boxes,
that data is carried over, even if the boxes text value is cleared in code.
(I have traced through and the boxes are being cleared in code.) Ironically,
under other circumstances I depend on this same 'effect' to get entered data,
but in this case it is completely unwanted.

What is happening here and how can data be carried over in this fashion?

Apr 12 '06 #3
How do you know if the data your seeing is the one you need?
And Why are they text boxes? can they be edited and saved? or is it
just to see the data?

If its just to see the data - Labels should be there - not text boxes.
If its to edit the data - try using the Ctrl+F5 in IE to refresh those
text boxes.

regards,

Stas K.

Apr 12 '06 #4
I'm sorry but I do not understand your response.

The controls must be textboxes because it is sometimes necessary to enter
or change data. My problem is that unwanted data seems to be carried over
into what should be a fresh display screen.

"Sorcerdon" wrote:
How do you know if the data your seeing is the one you need?
And Why are they text boxes? can they be edited and saved? or is it
just to see the data?

If its just to see the data - Labels should be there - not text boxes.
If its to edit the data - try using the Ctrl+F5 in IE to refresh those
text boxes.

regards,

Stas K.

Apr 12 '06 #5
This may be an IE issue...
Try clearing cache and refreshing.
regards,
Stas K.

Apr 12 '06 #6
When do you decide that the data in the TextBoxes is "unwanted"?

Is it before you sent the page to the user or after you collected data from
the user?

If it is before you sent to the user then set the EnableViewState in the
codebehind to false.

If it is after you received the data from the user, then add the code (that
resets the value for the textboxes) in the Page_PreRender event processing
(because the Page_PreRender is the last event triggered before the page is
rendered and would override any thing that happened during the load viewstate
stage of the page's lifecycle)
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"B. Chernick" wrote:
I'm sorry but I do not understand your response.

The controls must be textboxes because it is sometimes necessary to enter
or change data. My problem is that unwanted data seems to be carried over
into what should be a fresh display screen.

"Sorcerdon" wrote:
How do you know if the data your seeing is the one you need?
And Why are they text boxes? can they be edited and saved? or is it
just to see the data?

If its just to see the data - Labels should be there - not text boxes.
If its to edit the data - try using the Ctrl+F5 in IE to refresh those
text boxes.

regards,

Stas K.

Apr 12 '06 #7
What i mean by the reponse above,

It seems from the information you provided that you ARE prompting the
database one on page load to retrieve the data. Thus, I dont think it
is a SERVER/Development issue.
It looks like a cacheing issue. Try refreshing(F5), clearing cache,
also try using Ctrl+F5.

regards,
Stas K.

Apr 12 '06 #8
Again I am not sure I entirely understand you but I'm getting an idea.

The only thing that 'determines' whether the data is wanted in this screen
is which control triggers the postback, the submit button or a change in
dropdown selected index (a dropdown control separate from the grid.)

Are you saying I should set a variable to distinguish which control caused
the postback, check it in the prerender event, and repopulate the screen
there if necessary?

"Phillip Williams" wrote:
When do you decide that the data in the TextBoxes is "unwanted"?

Is it before you sent the page to the user or after you collected data from
the user?

If it is before you sent to the user then set the EnableViewState in the
codebehind to false.

If it is after you received the data from the user, then add the code (that
resets the value for the textboxes) in the Page_PreRender event processing
(because the Page_PreRender is the last event triggered before the page is
rendered and would override any thing that happened during the load viewstate
stage of the page's lifecycle)
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"B. Chernick" wrote:
I'm sorry but I do not understand your response.

The controls must be textboxes because it is sometimes necessary to enter
or change data. My problem is that unwanted data seems to be carried over
into what should be a fresh display screen.

"Sorcerdon" wrote:
How do you know if the data your seeing is the one you need?
And Why are they text boxes? can they be edited and saved? or is it
just to see the data?

If its just to see the data - Labels should be there - not text boxes.
If its to edit the data - try using the Ctrl+F5 in IE to refresh those
text boxes.

regards,

Stas K.

Apr 12 '06 #9
Since the decision over whether some data entered is wanted or not is based
on the control that triggers the postback then your question can be more
accurately restated as:

- How to reset the data displayed on some textboxes on the page to their
defaults if the user changed the selection on a dropdownlist that caused a
postback?

Am I correct?

One more question: Do you create the grid dynamically on your page or it is
placed declaratively and the data is then databound in the codebehind?

If the former (dynamically) then you need to separate the code that
initialize the grid complements from the code that populate the data. The
first would go in the page_init; the second would go in the page_prerender.
If the latter (declaratively) then place your code that creates the grid and
textboxes in the page_preRedner.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"B. Chernick" wrote:
Again I am not sure I entirely understand you but I'm getting an idea.

The only thing that 'determines' whether the data is wanted in this screen
is which control triggers the postback, the submit button or a change in
dropdown selected index (a dropdown control separate from the grid.)

Are you saying I should set a variable to distinguish which control caused
the postback, check it in the prerender event, and repopulate the screen
there if necessary?

"Phillip Williams" wrote:
When do you decide that the data in the TextBoxes is "unwanted"?

Is it before you sent the page to the user or after you collected data from
the user?

If it is before you sent to the user then set the EnableViewState in the
codebehind to false.

If it is after you received the data from the user, then add the code (that
resets the value for the textboxes) in the Page_PreRender event processing
(because the Page_PreRender is the last event triggered before the page is
rendered and would override any thing that happened during the load viewstate
stage of the page's lifecycle)
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"B. Chernick" wrote:
I'm sorry but I do not understand your response.

The controls must be textboxes because it is sometimes necessary to enter
or change data. My problem is that unwanted data seems to be carried over
into what should be a fresh display screen.

"Sorcerdon" wrote:

> How do you know if the data your seeing is the one you need?
> And Why are they text boxes? can they be edited and saved? or is it
> just to see the data?
>
> If its just to see the data - Labels should be there - not text boxes.
> If its to edit the data - try using the Ctrl+F5 in IE to refresh those
> text boxes.
>
> regards,
>
> Stas K.
>
>

Apr 12 '06 #10
The table is always created dynamically. On the designer it's nothing but an
empty shell.

For the moment I have solved the problem by setting a boolean when one of
the 'filter' dropdowns is changed. This triggers a call to the table
generation proc in the prerender event.

However, thanks for the idea about separating the initialization and
population code. There is probably a great deal we can do to improve the
efficiency of this screen.

Also thanks for your prompt response.

"Phillip Williams" wrote:
Since the decision over whether some data entered is wanted or not is based
on the control that triggers the postback then your question can be more
accurately restated as:

- How to reset the data displayed on some textboxes on the page to their
defaults if the user changed the selection on a dropdownlist that caused a
postback?

Am I correct?

One more question: Do you create the grid dynamically on your page or it is
placed declaratively and the data is then databound in the codebehind?

If the former (dynamically) then you need to separate the code that
initialize the grid complements from the code that populate the data. The
first would go in the page_init; the second would go in the page_prerender.
If the latter (declaratively) then place your code that creates the grid and
textboxes in the page_preRedner.

--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"B. Chernick" wrote:
Again I am not sure I entirely understand you but I'm getting an idea.

The only thing that 'determines' whether the data is wanted in this screen
is which control triggers the postback, the submit button or a change in
dropdown selected index (a dropdown control separate from the grid.)

Are you saying I should set a variable to distinguish which control caused
the postback, check it in the prerender event, and repopulate the screen
there if necessary?

"Phillip Williams" wrote:
When do you decide that the data in the TextBoxes is "unwanted"?

Is it before you sent the page to the user or after you collected data from
the user?

If it is before you sent to the user then set the EnableViewState in the
codebehind to false.

If it is after you received the data from the user, then add the code (that
resets the value for the textboxes) in the Page_PreRender event processing
(because the Page_PreRender is the last event triggered before the page is
rendered and would override any thing that happened during the load viewstate
stage of the page's lifecycle)
--
HTH,
Phillip Williams
http://www.societopia.net
http://www.webswapp.com
"B. Chernick" wrote:

> I'm sorry but I do not understand your response.
>
> The controls must be textboxes because it is sometimes necessary to enter
> or change data. My problem is that unwanted data seems to be carried over
> into what should be a fresh display screen.
>
> "Sorcerdon" wrote:
>
> > How do you know if the data your seeing is the one you need?
> > And Why are they text boxes? can they be edited and saved? or is it
> > just to see the data?
> >
> > If its just to see the data - Labels should be there - not text boxes.
> > If its to edit the data - try using the Ctrl+F5 in IE to refresh those
> > text boxes.
> >
> > regards,
> >
> > Stas K.
> >
> >

Apr 12 '06 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Rodrigo DeJuana | last post by:
Howdy, I'm new to this .net stuff and really have little to no training. Im trying to create a new page for a web form, so i have been pretty much jsut coping code. I having some issue with...
0
by: Zi | last post by:
I have a user control within a data grid. I am binding the user control to one of the values from the data grid. The data grid implements paging. It is all working ok for the first page but once i...
6
by: hb | last post by:
Hi, I have a page bill.aspx and its code-behind bill.aspx.cs. On bill.aspx I have: === Select a month: <asp:dropdownlist runat="server" id="lstDate" autopostback="True" /> <br> <asp:table...
3
by: Luis Esteban Valencia | last post by:
A page let of work for me I commented almost all lines but nothing the code is this
0
by: Benjamin Bittner | last post by:
Hallo NG, ive searched a lot in some google groups, and found many threads, but nothing that helped me. Here is the scenario: I have an aspx page which loads a user control in page.onInit like...
0
by: Rick Hein | last post by:
I've got a problem with an app I've been working on, the Caching object and events not firing correctly. In a nutshell: When I'm debugging, and I set a breakpoint in the removed item call back, the...
3
by: Aaron | last post by:
Why do my session values return to nothing on post back? I want to click a button and have the row, as in: dataset.table(0).rows(THIS ROW NUMBER IS WHAT I AM TALKING ABOUT), either increment or...
2
by: DC | last post by:
The Code <%@ import namespace="System" %> <%@ import namespace="System.Web" %> <%@ import namespace="System.Web.UI" %> <%@ import namespace="System.Web.UI.HtmlControls" %> <%@ import...
0
by: DC | last post by:
The problem I'm using the .NET GridView and FormView objects for the first time and im getting the error "An OleDbParameter with ParameterName '@ID' is not contained by this...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.