By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,967 Members | 1,625 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,967 IT Pros & Developers. It's quick & easy.

updateproblem with usercontrol, page and masterpage

P: n/a
Hi,

the situation is the following:

There is this masterpage:
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="mymaster.master.cs" Inherits="mymaster" %>

<%@ Register tagprefix="myc" tagname="BasketSmall"
Src="shop/basket_small.ascx" %>

<html>

<body>

<form id="form1" runat="server">

<myc:BasketSmall runat="server" ID="smallbasket" />

<asp:contentplaceholder runat="server" ID="mycontent"> sample content
</asp:contentplaceholder>


</form>

</body>

</html>

The UserControl reads out a session-variable and displays it.

Then there is a page which uses the masterpage. It modifies the value of the
session-var if a button on the page is clicked and a postback is done.

The usercontrol displays the old value and not the new! Only after a new
postback (or a reload of the page) the correct value is displayed.
In the Page_Load function of the usercontrol is not written: "DataBind();"

How can I resolve this problem?

Thanks,
Alex
Dec 15 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
I would assume that the Master Page is processed before the normal
page. Don't really have the solution though. Maybe if you use OnInit()
instead of Page_Load() to do it? Sorry, just a shot into the dark...
But please let me know if you find the answer, would be interesting.

Remy Blaettler
www.collaboral.com

Dec 15 '05 #2

P: n/a
I found a solution...
I changed the Page_Load content of the UserControl to an other
function(-name), e.g. "updatebasket" , and let the Page_Load call this.
And then I created a function in the masterpage which calls this function
(updatebasket).
The click on the button now causes the change of the data in the
sessionvar
and calls the function in the masterpage which calls the updatebasket.
It is a solution ... perhaps not the best.
"Remy" <rb********@hotmail.com> schrieb im Newsbeitrag
news:11**********************@g14g2000cwa.googlegr oups.com...
I would assume that the Master Page is processed before the normal
page. Don't really have the solution though. Maybe if you use OnInit()
instead of Page_Load() to do it? Sorry, just a shot into the dark...
But please let me know if you find the answer, would be interesting.

Remy Blaettler
www.collaboral.com

Dec 15 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.