 |
| ASP.NET 1.0 and 1.1 Professional For advanced ASP.NET 1.x coders. Beginning-level questions will be redirected to other forums. NOT for "classic" ASP 3 or the newer ASP.NET 2.0 and 3.5 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the ASP.NET 1.0 and 1.1 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

October 26th, 2006, 06:56 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
|
|
One more question!!
Hi Friends
Its a general problem I am facing, I am making a registration form which has a series of steps, so for these steps I am using usercontorls on one form, now in one of my steps, I make the user add a status and an image associated with it, user can add as many as status with the Add New button , then the user presses the next button and moves to the next step, but when the user presses back button to go the previous step i.e. the status step, the grid of status is not being bound, i.e. the itemdatabound even is not being called. Any ideas????
Regards
Mike
__________________
Regards
Mike
|
|

October 26th, 2006, 07:31 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Thats because the page is being pulled from cache, e.g. the page isn't loading and refreshing the data again.
-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
^^Thats my signature
|
|

October 26th, 2006, 07:45 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Ya
I thought the same reason, I have used Response.Expires = -1; to avoid this issue, but to no avail. Any ideas what can be done.
Regards
Mike
|
|

October 26th, 2006, 07:52 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Set Response.Expires = 0 not -1 and you can look into the javascript method document.location.replace() which would replace the last page the user visited with the current page.
-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
^^Thats my signature
|
|

October 26th, 2006, 08:44 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
|
|
No luck parsons, have tried the code below to no avail:
Response.CacheControl = "no-cache";
Response.AddHeader("Pragma", "no-cache");
Response.Expires = 0;
Response.Buffer = true; (tried both true and false)
Also, couldn't get the use of javascript method you suggested. Any further help would be appreciated as this has to be completed within 2 hrs.
Regards
Mike
|
|

October 26th, 2006, 08:53 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
2 things you can try: In your code behind for the page you dont want to cache you can do:
Response.Cache.SetCacheability(HttpCacheability.No Cache);
or on the page itself you can set this page attribute:
<%@ OutputCache Location="None" %>
(They both mean the same thing, one is just in code and the other is a page attribute)
-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
^^Thats my signature
|
|

October 26th, 2006, 09:04 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Well hard luck
That too didn't work, anyways I will try to manage something else, lets see.......
Regards
Mike
|
|

October 26th, 2006, 09:09 AM
|
|
Wrox Author
|
|
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
|
|
Thats very strange as those are the only ways to really set your cache through .NET weird.
-------------------------
I will only tell you how to do it, not do it for you.
Unless, of course, you want to hire me to do work for you.
^^Thats my signature
|
|

October 26th, 2006, 09:10 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi Mike.,
Are you sure it's a caching issue? What happens when you set a breakpoint in the Page_Load method? Is it hit once (page load only) or twice (on PostBack as well)??
In the latter case, set a hook on ItemCreated. Depending on how you bind data, ItemDataBound isn't always called, but ItemCreated is when items are recreated from ViewState.
Cheers,
Imar
|
|

October 26th, 2006, 09:22 AM
|
|
Friend of Wrox
|
|
Join Date: Aug 2004
Posts: 550
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Parsons and Imar,
Thanx for the efforts, I solved the problem, but really some strange way, I would definately like some comments on this from you senior guys.
Imar, there is no Page_Load declared in the usercontrol, there is a public Init() method that is being called from the main page something like below:
((IEditProjectControl)ctlWizardStep).ProjectId = ProjectId;
((IEditProjectControl)ctlWizardStep).Init();
where IEditProjectControl is an interface maintaining ProjectId
Now how did I solve the problem, I had a label control in grid showing status name and image control showing image, both these were bound on itemdatabound event. Strangely, I removed the label control and bound directly from HTML like below:
<asp:TemplateColumn HeaderText="Status">
<headerstyle horizontalalign="Left" cssclass="gridHeader"></headerstyle>
<itemstyle cssclass="gridFirstItem" width="80%"></itemstyle>
<ItemTemplate>
<%#DataBinder.Eval(Container.DataItem,"Name")%>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Image">
<headerstyle horizontalalign="Center" cssclass="gridHeader"></headerstyle>
<itemstyle horizontalalign="Center" cssclass="gridItem" width="10%"></itemstyle>
<ItemTemplate>
<asp:Image id="Image1" ImageUrl='<%#"~/Images/Status/" + DataBinder.Eval(Container.DataItem,"ImageUrl")%>' runat="Server" />
</ItemTemplate>
</asp:TemplateColumn>
And it worked!!!!!!!!!!! Any explanations for this, can I trust that it would work fine....
Regards
Mike
|
Similar Threads
|
| Thread |
Thread Starter |
Forum |
Replies |
Last Post |
| question |
maheshraju |
ASP.NET 2.0 Basics |
3 |
March 13th, 2008 08:54 AM |
| Question |
Ashwini |
Classic ASP Databases |
3 |
January 10th, 2006 07:20 AM |
| Question? |
Calibus |
Classic ASP Databases |
8 |
August 6th, 2004 08:25 AM |
| a question |
gorji |
C++ Programming |
2 |
August 11th, 2003 07:41 AM |
|
 |