473,729 Members | 2,331 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

content page subscriber to master page event doesn't update on 2nd postback

Hello All,

Here is my issue and thanks in advance for any assistance.

I have a base page with a dropdownlist that fires an event with
the selected index. The content page catches the event and sets
a connection string to the database. The content page has a
simple gridview that should show records from the selected
database. Initial content page displays data from correct place.
first change of dropdownlist correctly updates content page
gridview. any drop down list changes after that are ineffective.
I've attempted session state index saving in conjunction with
content page and master page load events during postback and not
postback. I've slimmed down to the basics to show my problem.
Here is the flow....

CP = Content Page
MP = Master Page

This is the first page load. The first four things listed here
happen every page.

CP::CP Constructor to content page
MP::MP Constructor to Master page
MP::MP_Init Master page init
CP::Page_Init Page INIT
(subscribe to select change event)

CP::Page_Load:N OTPostBack Initial call to page_load
CP::GridView1_D ataBound bind it up and display records from
default db. this works to correct
database.

----------------------------------------------------------------------------------------------------
CP::Page_Load:P ostBack the first postback
MP::CSDDL_SIC FIRED master page drop down changed by user
MP::Fire Index(1) master fires new index to content page
CP::Catch Index(1) content page catches
CP::GridView1_D ataBound bind it up and display records from new
database. this works perfectly
----------------------------------------------------------------------------------------------------
CP::Page_Load:P ostBack another post back to content page
MP::CSDDL_SIC FIRED master page drop down changed by user
MP::Fire Index(0) master fires new index to content page
CP::Catch Index(0) content page catches
*****Lack of LLT::GridView1_ DataBound here and on all subsequent
dropdownlist changes*****

MASTER CODEBEHIND
public partial class MyMasterPage : MasterBase
{
public event ConnStrChangedE ventHandler ConnStrChanged;

public MyMasterPage() {
Debug.WriteLine (String.Format( "MP::MP"));
this.Init += new System.EventHan dler(this.MyMas terPage_Init);
}

protected void CSDDL_SIC(objec t sender, EventArgs e) {
Debug.WriteLine (String.Format( "MP::CSDDL_ SIC FIRED"));
ConnStrChangedE ventArgs CSCEA;
CSCEA = new ConnStrChangedE ventArgs(CSDDL. SelectedIndex);
if (ConnStrChanged != null) {
Debug.WriteLine (
String.Format(" MP::Fire Index({0})", CSCEA.Index));
ConnStrChanged( this, CSCEA);
}
}

private void MyMasterPage_In it(object sender, EventArgs e) {
Debug.WriteLine (String.Format( "MP::MyMasterPa ge_Init"));
CSDDL.Items.Add (new ListItem("DEV1" ));
CSDDL.Items.Add (new ListItem("ATLQA "));
CSDDL.SelectedI ndex = 0;
}
}

CP(CONTENT) CODEBEHIND
public partial class CP : System.Web.UI.P age {
public CP() {
Debug.WriteLine ("CP::CP");
this.Load += new System.EventHan dler(Page_Load) ;
this.Init += new System.EventHan dler(Page_Init) ;
}

protected void Page_Init(objec t sender, EventArgs e) {
Debug.WriteLine ("CP::Page_Init ");
Master.ConnStrC hanged += new
ConnStrChangedE ventHandler(Mas ter_ConnStrChan ged);
}

void Master_ConnStrC hanged(object sender, ConnStrChangedE ventArgs e)
{
Debug.WriteLine (String.Format( "CP::Catch Index({0})", e.Index));
SqlDataSource1. ConnectionStrin g =
ConfigurationMa nager.Connectio nStrings[e.Index + 1].ConnectionStri ng;
}

protected void Page_Load(objec t sender, EventArgs e) {
if (IsPostBack) {
Debug.WriteLine ("CP::Page_Load :PostBack");
}
else {
Debug.WriteLine ("CP::Page_Load :NOTPostBack");
}
}

ENTIRE LISTING OF MASTERPAGE.MAST ER FILE
<%@ Master Language="C#"
AutoEventWireup ="true"
CodeFile="Maste rPage.master.cs "
Inherits="MyMas terPage" %>
<html>
<head runat="server"> <title>W</title></head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:contentpla ceholder id="CP" runat="server" />
</td>
</tr>
<tr>
<td>Database</td>
<td>
<asp:DropDownLi st
ID="CSDDL"
runat="server"
AutoPostBack="T rue"
OnSelectedIndex Changed="CSDDL_ SIC" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

LLT.ASPX (Content Page) stripped
<%@ Page Language="C#"
MasterPageFile= "~/MasterPage.mast er"
AutoEventWireup ="true"
CodeFile="WF_ST ATUS.aspx.cs"
Inherits="LLT"
EnableSessionSt ate="True" %>
<%@ MasterType TypeName="MyMas terPage" %>
<asp:Content ID="Content1"
ContentPlaceHol derID="CP"
Runat="Server">
<div>
<asp:GridView
ID="GridView1"
runat="server"
DataSourceID="S qlDataSource1"
OnRowDataBound= "GridView1_RowD ataBound"
OnDataBound="Gr idView1_DataBou nd" />
<asp:SqlDataSou rce />
</div>
</asp:Content>

Jul 27 '06 #1
0 2113

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

Similar topics

2
3626
by: John Lau | last post by:
Hi, Is there documentation that talks about the page lifecycle, the lifecycle of controls on the page, and the rendering of inline code, in a single document? Thanks, John
6
2956
by: MooreSmnith | last post by:
When I navigate to the next page using Response.Rediect("MyNextPage.aspx") current page Page_Load event is called. What I may wrongly understood is that post back will happen whenever there is any server side event happens, resulting in Page_load event. Page_Load is also happening when I navigate to the next page. That means Page_load will always happen when I navigate to the next page. Please correct me If I have totally misunderstood...
1
1283
by: TCORDON | last post by:
I have a master page that has a public property IdCountry. This property is changed by a user control on the master page using a "Bubbled" event so the event is handled on the master page for other reasens becaus it has to update other content on the master page then the country is chaged, so far, so good. The problem starts when the content section in a page that uses this master page tries to read that property, because it reads it on the...
5
2563
by: Federico | last post by:
I have a problem, I have an event declared in a Master Page, and I want to use in a Content Page holder of a Content Page. When I want to create the method to handle the event, I can njot reference the Master Page event, in its place IntelliSense shows me a Delegate Sub EventHandler. I am new with events managements, so any help and guiadance will be appreciated. Federico
8
1420
by: William Buchanan | last post by:
Hi folks I have a "Search" text box and LinkButton in my master page. When this is submitted, I do a Server.Transfer to a page which contains a gridview. The gridview is filtered on a hidden field which I set in the page load method (from the search text box text). Now, the grid view appears to filter correctly, however, when I select a record in the gridview to populate a DetailsView, I loose the original filter and so the returned...
0
1303
by: Ben S | last post by:
vs2005, .net fw 2.0 the questions is, how can I cause the label to change in my client page triggered by an event raised from the user control which is on my master page. I have a master page (M) which contain a user control (U). My client page (C) has a sub that needs to run if U raise an event. The examlpe has been simplified to just button clicks and update label with
2
1919
by: Zetatec2 | last post by:
I have a site I am making. It contains one master page that has two ASP label controls and about sixteen ASP button controls on it. Then I have sixteen content or slave pages. The user clicks on a button and that brings up the corrsiponding slave page in the master page. When a slave page comes up, data is read from a SQL server database into the ASP text boxes and ASP check boxes of each slave page. Once the controls have been...
2
1726
by: BillE | last post by:
I am using master/content pages, with a treeview in my master page. When the selected node changed event fires in the treeview, I redirect to the requested content page associated with the selected node in the treeview. When this treeview event occurs in the master page, I noticed that the current content page posts back (IsPostback is true), prior to the requested postback page loading.
8
2194
by: Ben | last post by:
Hi, i'm trying to build a simple site navigation (using c#)... i implemented a master page that shows a sidebar user control on the left side, and a content page on the right. i click the link on the sidebar which calls Redirect. problem is that the whole page refreshes... i just want the right side to update to a new content.
0
9426
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9281
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9200
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9142
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8148
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6022
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4525
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.