Control Usage Order Problem
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngcontrolscs' list.


Julian Voelcker
I have a control on a page as well as a table above it.

The table shows a list of records in a database table and the control
below it provides an editor interface it for adding, editing and
deleting records.

The code I am using for loading the control and the tables is as
follows:-

private void Page_Load(object sender, System.EventArgs e)
{
AdminEditor Editor1 = new AdminEditor();
Editor1.ConfigFile ="/admin.config";
Editor1.TableToEdit = "Users";
Editor1.UseScrollableLayer = false;
PlaceHolder1.Controls.Add(Editor1);
ListUsers();
Literal1.Text = sHTML.ToString();
}

The function ListUsers() generates the table as a StringBuilder string
using data from the database (sHTML) which is then output to the
Literal.

The editor control builds a form and saves the data to the database
when submitted.

The page works fine, except that when I add new users to the database,
they don't appear in the list until the form is submitted again.

How can I change the order of when things occur?

Cheers,

Julian Voelcker
The Virtual World (UK) Limited
Cirencester, United Kingdom

Reply to this message...
 
    
devin
I had this exact same problem, and ended up putting the table binding =
code in the Page_Rendering event.

HTH
Devin

----- Original Message -----
From: Julian Voelcker <Click here to reveal e-mail address>
To: Click here to reveal e-mail address
Sent: Thu, 06 Jun 2002 15:26:10 +0100
Subject: Control Usage Order Problem
[Original message clipped]

Reply to this message...
 
    
Julian Voelcker
Devin, I suppose that is one way around it, however I would be
interested to know why it has happened in the first place.

For info, the control builds it's own table using the table control
with all major functionality occurring in the CreateChildControls()
method.

Can anybody else shed light on this?

Cheers,

Julian Voelcker
The Virtual World (UK) Limited
Cirencester, United Kingdom

Reply to this message...
 
    
Vandana Datye (DevCepts)
In which life cycle phase does your editor save data to the database?
Since the list is being populated in Load, if the editor updates the
database in a subsequent phase, you won't see the changes until the next
request to the page.

Vandana

-----Original Message-----
From: Julian Voelcker [mailto:Click here to reveal e-mail address]=20
Sent: Thursday, June 06, 2002 7:26 AM
To: aspngcontrolscs
Subject: [aspngcontrolscs] Control Usage Order Problem

I have a control on a page as well as a table above it.

The table shows a list of records in a database table and the control=20
below it provides an editor interface it for adding, editing and=20
deleting records.

The code I am using for loading the control and the tables is as=20
follows:-

private void Page_Load(object sender, System.EventArgs e)
{
AdminEditor Editor1 =3D new AdminEditor();
Editor1.ConfigFile =3D"/admin.config";
Editor1.TableToEdit =3D "Users";
Editor1.UseScrollableLayer =3D false;
PlaceHolder1.Controls.Add(Editor1);
ListUsers();
Literal1.Text =3D sHTML.ToString();
}

The function ListUsers() generates the table as a StringBuilder string=20
using data from the database (sHTML) which is then output to the=20
Literal.

The editor control builds a form and saves the data to the database=20
when submitted.

The page works fine, except that when I add new users to the database,=20
they don't appear in the list until the form is submitted again.

How can I change the order of when things occur?

Cheers,

Julian Voelcker
The Virtual World (UK) Limited
Cirencester, United Kingdom

| [aspngcontrolscs] member Click here to reveal e-mail address =3D YOUR ID
| http://www.asplists.com/asplists/aspngcontrolscs.asp =3D JOIN/QUIT
| http://www.asplists.com/search =3D SEARCH Archives

Reply to this message...
 
    
Julian Voelcker
Coming back to this one...

The AdminEditor control uses the CreateChildControls method to create the
form and to save contents to the database on postback.

What I need to do is to fire the ListUsers() method after the data has
been saved.

I belive I need to set it to fire when the page is rendered, but don't
know the syntax to use.

Cheers,

Julian Voelcker
The Virtual World (UK) Limited
Cirencester, United Kingdom

[Original message clipped]

Reply to this message...
 
 
System.EventArgs
System.Text.StringBuilder




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com