CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > windows_hosting.hosting_open_forum Tags:
Item Type: NewsGroup Date Entered: 3/15/2004 11:34:29 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 10 Views: 60 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
11 Items, 1 Pages 1 |< << Go >> >|
dj4uk
Asp.Net User
Composite Control Problem with Bubble Events3/15/2004 11:34:29 AM

0/0

I've written a composite control that bubbles events from its child controls up to the main control. This seems to work fine for the following.

If for example I assign a new value to a label on the same page as the control:

void AddFolder_Click( object s, EventArgs e ) {
test.Text = "Add Folder";
}

Where in the page:

<FDRCTLS:FolderControl id="fileWindow" Runat="Server" OnTaskAddFolderClick="AddFolder_Click" />

This will indeed update the label (test) on postback.

However, if I try to do the following:

void Logout_Click( object s, EventArgs e ) {
Session.Abandon();
FormsAuthentication.SignOut();
}

Where in the page:

<FDRCTLS:FolderControl id="fileWindow" Runat="Server" OnLogoutClick="Logout_Click" />

I would have thought it would redirect me to the specified login page (this is using forms authentication), however the page still appears after the postback. If I refresh the page (F5) then it redirects me to the login page. I think this is to do with the order that the page is built but not 100% sure.

Help me please!

DJ
master4eva
Asp.Net User
Re: Composite Control Problem with Bubble Events3/15/2004 2:29:21 PM

0/0

It actually has to do with the request lifecycle than with the page lifecycle. The best suggestion that I can offer is for you to use Response.Redirect method to your login page.
-- Justin Lovell
dj4uk
Asp.Net User
Re: Composite Control Problem with Bubble Events3/15/2004 2:37:27 PM

0/0

Well what I've done is redirect to the same page (simulates refreshing the page) which does the job.

However the big problem is that my other events have the same problem - which can't be resolved in this way. Could this be caused by having composite controls within composite controls? Do I need to convert them to rendered controls?

DJ
fancyketsup
Asp.Net User
Re: Composite Control Problem with Bubble Events3/15/2004 3:10:24 PM

0/0

Without seeing more code its hard to say whats happening. I suspect its this, but I am just guessing.... To access the page you must be logged in so when you refresh it of course its going to send you to the login page. Also just calling SignOut() is not going to redirect the user, and if your hoping that because the session is abandoned and the user is logged out that the response back to the client will cause a redirect because the session has ended and they are not logged in then your barking up the wrong tree. Add a redirect like Response.Redirect(Request.ApplicationPath) to Logout_Click... so yes if not redirected it will take the user back to that same secure page even thow they are not logged in because it is already pass the ath. stage and is just ending the request caused by the post back. So now you have an un-ath'd user looking at a secure page even though you have your code working and the session Abandoned. A simple redirect makes everyone behave properly.(hehe in theory atleast)
Answering a question increases your knowledge asking a question shows your Intelligence!
dj4uk
Asp.Net User
Re: Composite Control Problem with Bubble Events3/15/2004 3:30:47 PM

0/0

If you go to http://www.hrocupload.co.uk/test2.html you can see the trace information for my control. Basically there is a main composite control called FolderControl that also contains two other composite controls - FolderTaskPane and FolderContentsPane. Within all three of these controls there are standard server controls - you can see this in the control tree.

I've added my own custom trace warning and you can see that two of the controls are created before the event is fired - could this be why you need to refresh the page before an event is actioned?

I'm really lost - please help!

DJ
master4eva
Asp.Net User
Re: Composite Control Problem with Bubble Events3/15/2004 6:01:15 PM

0/0

It has nothing to do with the controls. You see when the page is requested, the HttpApplication starts up. It then does the security check there (via HttpModules) and then if the requestor has the rights, the rest of the request is then handled. That is when the page actually starts executing - and all the controls underneath it. Therefore, while the page is being requested, the security context is not checked up here because it was done a long time ago... even before the page executed.

That is your reason why the above behaviour happens and there is no other solution than to restart the http request. Makes sense?
-- Justin Lovell
dj4uk
Asp.Net User
Re: Composite Control Problem with Bubble Events3/16/2004 8:07:32 AM

0/0

OK I getcha with regard to the security check however when I fire an event that should change a property within the composite control - e.g. OnAddFolderClick the width of the control is changed - it does the same thing i.e. nothing on Postback but when the page is refreshed it is actioned. Surely this isn't the correct behaviour - I'm sure its a problem with my code.

DJ
master4eva
Asp.Net User
Re: Composite Control Problem with Bubble Events3/16/2004 12:29:42 PM

0/0

I am not sure what behaviour that you are getting... just to confirm - when an event is being raised, then the width of the control changes.

I think that you will have to shoot some code for that problem.
-- Justin Lovell
dj4uk
Asp.Net User
Re: Composite Control Problem with Bubble Events3/16/2004 1:13:00 PM

0/0

OK below is the code for two composite controls - FolderControl and FolderTaskPane - FolderTaskPane is used within FolderControl. FolderControl also uses another composite control called FolderContentsPane but I haven't included the code for that as it has no events associated with it.

Basically FolderTaskPane contains LinkButtons and ImageButtons whose events bubble up to the composite controls.

When these events eventually reach FolderControl then they can be used in an aspx page.

I have been trying to alter FolderControls appearance according to events fired. So lets say OnTaskAddFolderClick the width of the FolderControl should change. If I try this on postback nothing changes however if I refresh the page the width changes - it seems that the control is being rendered before the event can change the width property. The events always seem to be one postback behind.

FolderControl:

public class FolderControl: Control, INamingContainer {
private FolderTaskPane taskpane;
private FolderContentsPane contentpane;
private ImageButton logoutImage;

public event EventHandler TaskFolderUpClick;
public event EventHandler TaskAddFolderClick;
public event EventHandler TaskUploadFileClick;
public event EventHandler TaskEditUsersClick;
public event EventHandler TaskAddClientFolderClick;
public event EventHandler LogoutClick;

protected override void CreateChildControls()
{
this.Controls.Clear();
Context.Trace.Warn( "Folder Control Child Controls being created");
if ( this.Position != PositionEnum.None ) {
this.Controls.Add( new LiteralControl( "<div style=\"position: " + this.Position.ToString() + "; z-index:100; left: " + Left + "px; top: " + Top + "px; width: " + Width + "px; height: " + Height + "px; border: 2px ridge #D4D0C8; background-color: #FFFFFF;\">\n" ) );
} else {
this.Controls.Add( new LiteralControl( "<div style=\"width: " + Width + "px; height: " + Height + "px; border: 2px ridge #D4D0C8; background-color: #FFFFFF;\">\n" ) );
}

this.Controls.Add( new LiteralControl( "<table cellpadding=\"2\" cellspacing=\"0\" width=\"" + Width + "\">\n" ) );
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #3A5793;\">\n" ) );
this.Controls.Add( new LiteralControl( "<td height=\"16\" width=\"20\"><img src=\"/images/folder_small.gif\" width=\"16\" height=\"16\"></td>\n" ) );

if ( FolderPath == "/" ) {
this.Controls.Add( new LiteralControl( "<td height=\"16\" width=\"" + (Width - 40).ToString() + "\"><b style=\"color: #FFFFFF;\">Root</b></td>\n" ) );
} else {
this.Controls.Add( new LiteralControl( "<td height=\"16\" width=\"" + (Width - 40).ToString() + "\"><b style=\"color: #FFFFFF;\">" + FolderPath + "</b></td>\n" ) );
}
this.Controls.Add( new LiteralControl( "<td height=\"16\" width=\"20\">\n" ) );

logoutImage = new ImageButton();
logoutImage.ImageUrl = "/images/logout.gif";
logoutImage.ToolTip = "Logout Extranet";
logoutImage.AlternateText = "Logout Extranet";
logoutImage.BorderStyle = BorderStyle.None;
logoutImage.Width = 16;
logoutImage.Height = 16;
logoutImage.CommandName = "LogoutClick";
this.Controls.Add( logoutImage );

this.Controls.Add( new LiteralControl( "</td>\n</tr>\n</table>\n" ) );

taskpane = new FolderTaskPane();
taskpane.FolderPath = FolderPath;
taskpane.NewFolder = NewFolder;
taskpane.EditUsers = EditUsers;
taskpane.UploadFile = UploadFile;
taskpane.AddFolder = AddFolder;
taskpane.Position = PositionEnum.Absolute;
taskpane.Top = 24;
taskpane.Left = 4;
taskpane.Height = Height - 8 - taskpane.Top;
if ( Width < 399 ) {
taskpane.Width = taskpane.Width - (399 - Width) / 2;
}
this.Controls.Add( taskpane );

contentpane = new FolderContentsPane();
contentpane.FolderPath = FolderPath;
contentpane.ViewFiles = ViewFiles;
contentpane.Position = PositionEnum.Absolute;
contentpane.Top = 20;
contentpane.Left = 4 + taskpane.Width;
contentpane.Height = Height - 4 - contentpane.Top;
if ( Width < 399 ) {
contentpane.Width = taskpane.Width - ((399 - Width) / 2) + ((399 - Width) % 2);
} else {
contentpane.Width = Width - taskpane.Width - 4;
}
this.Controls.Add( contentpane );

this.Controls.Add( new LiteralControl( "</div>\n" ) );
}

protected override bool OnBubbleEvent( object source,
EventArgs e )
{
bool handled = false;

if (e is CommandEventArgs) {
CommandEventArgs ce = (CommandEventArgs)e;
if (ce.CommandName == "FolderUpClick") {
OnTaskFolderUpClick(ce);
handled = true;
} else if (ce.CommandName == "AddFolderClick") {
OnTaskAddFolderClick(ce);
handled = true;
} else if (ce.CommandName == "UploadFileClick") {
OnTaskUploadFileClick(ce);
handled = true;
} else if (ce.CommandName == "EditUsersClick") {
OnTaskEditUsersClick(ce);
handled = true;
} else if (ce.CommandName == "AddClientFolderClick") {
OnTaskAddClientFolderClick(ce);
handled = true;
} else if (ce.CommandName == "LogoutClick") {
OnLogoutClick(ce);
handled = true;
}
}

return handled;
}

protected virtual void OnTaskFolderUpClick (EventArgs e)
{
if (TaskFolderUpClick != null) {
TaskFolderUpClick(this,e);
}
}

protected virtual void OnTaskAddFolderClick (EventArgs e)
{
if (TaskAddFolderClick != null) {
TaskAddFolderClick(this,e);
}
}

protected virtual void OnTaskUploadFileClick (EventArgs e)
{
if (TaskUploadFileClick != null) {
TaskUploadFileClick(this,e);
}
}

protected virtual void OnTaskEditUsersClick (EventArgs e)
{
if (TaskEditUsersClick != null) {
TaskEditUsersClick(this,e);
}
}

protected virtual void OnTaskAddClientFolderClick (EventArgs e)
{

if (TaskAddClientFolderClick != null) {
TaskAddClientFolderClick(this,e);
}
}

protected virtual void OnLogoutClick (EventArgs e)
{
if (LogoutClick != null) {
LogoutClick(this,e);
}
}

public string FolderPath {
get
{
string f = (string) ViewState["FolderPath"];

return ( f == null ) ? String.Empty : (string) f;
}
set
{
ViewState["FolderPath"] = value;

this.SplitPath = value.Split( new char[] {'/'} );
}
}

protected string[] SplitPath {
get
{
object obj = ViewState["SplitPath"];

return (obj == null) ? new string[0] : (string[]) ViewState["SplitPath"];
}
set
{
ViewState["SplitPath"] = value;

this.FolderName = value[ value.Length - 1 ];
}
}

protected string FolderName {
get
{
string f = (string) ViewState["FolderName"];

return ( f == null ) ? String.Empty : (string) f;
}
set
{
ViewState["FolderName"] = value;
}
}

public bool NewFolder {
get
{
object obj = ViewState["NewFolder"];

return (obj == null) ? false : (bool) ViewState["NewFolder"];
}
set
{
ViewState["NewFolder"] = value;
}
}

public bool AddFolder {
get
{
object obj = ViewState["AddFolder"];

return (obj == null) ? false : (bool) ViewState["AddFolder"];
}
set
{
ViewState["AddFolder"] = value;
}
}

public bool UploadFile {
get
{
object obj = ViewState["UploadFile"];

return (obj == null) ? false : (bool) ViewState["UploadFile"];
}
set
{
ViewState["UploadFile"] = value;
}
}

public bool EditUsers {
get
{
object obj = ViewState["EditUsers"];

return (obj == null) ? false : (bool) ViewState["EditUsers"];
}
set
{
ViewState["EditUsers"] = value;
}
}

public bool ViewFiles {
get
{
object obj = ViewState["ViewFiles"];

return (obj == null) ? false : (bool) ViewState["ViewFiles"];
}
set
{
ViewState["ViewFiles"] = value;
}
}

public int Width {
get
{
object obj = ViewState["Width"];

return (obj == null) ? 600 : (int) ViewState["Width"];
}
set
{
ViewState["Width"] = value;
}
}

public int Height {
get
{
object obj = ViewState["Height"];

return (obj == null) ? 350 : (int) ViewState["Height"];
}
set
{
ViewState["Height"] = value;
}
}

public int Left {
get
{
object obj = ViewState["Left"];

return (obj == null) ? 0 : (int) ViewState["Left"];
}
set
{
ViewState["Left"] = value;
}
}

public int Top {
get
{
object obj = ViewState["Top"];

return (obj == null) ? 0 : (int) ViewState["Top"];
}
set
{
ViewState["Top"] = value;
}
}

public PositionEnum Position {
get
{
object obj = ViewState["Position"];

return (obj == null) ? PositionEnum.None : (PositionEnum) obj;
}
set
{
ViewState["Position"] = value;
}
}
}


FolderTaskPane:

public class FolderTaskPane: Control, INamingContainer {
private LinkButton upLink;
private LinkButton folderLink;
private LinkButton fileLink;
private LinkButton userLink;
private ImageButton upImage;
private ImageButton folderImage;
private ImageButton fileImage;
private ImageButton userImage;

public event EventHandler FolderUpClick;
public event EventHandler AddFolderClick;
public event EventHandler UploadFileClick;
public event EventHandler EditUsersClick;
public event EventHandler AddClientFolderClick;

protected override void CreateChildControls()
{
this.Controls.Clear();
Context.Trace.Warn( "Folder TaskPane Control Child Controls being created");
if ( this.Position != PositionEnum.None ) {
this.Controls.Add( new LiteralControl( "<div style=\"position: " + this.Position.ToString() + "; z-index:100; left: " + Left + "px; top: " + Top + "px; width: " + Width + "px; height: " + Height + "px; overflow: auto;\">\n" ) );
} else {
this.Controls.Add( new LiteralControl( "<div style=\"width: " + Width + "px; height: " + Height + "px; overflow: auto;\">\n" ) );
}

if ( FolderPath != String.Empty ) {
if ( Directory.Exists( Page.MapPath( "/files" + FolderPath ) ) ) {
if (this.AddFolder || this.UploadFile || this.EditUsers) {
this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + (Width - 20) + ";\">\n" ) );

this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th colspan=\"2\" style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">File and Folder Tasks</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );

if ( FolderPath != "/" ) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td>\n" ) );

upImage = new ImageButton();
upImage.ImageUrl = "/images/folderup.gif";
upImage.ToolTip = "Move up one level";
upImage.AlternateText = "Move up one level";
upImage.BorderStyle = BorderStyle.None;
upImage.Width = 16;
upImage.Height = 16;
upImage.CommandName = "FolderUpClick";
this.Controls.Add( upImage );

this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );

upLink = new LinkButton();
upLink.Text = "Move up one level";
upLink.ToolTip = "Move up one level";
upLink.CommandName = "FolderUpClick";
this.Controls.Add ( upLink );

this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );
}

if ( this.AddFolder ) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td>\n" ) );

if ( FolderPath == "/" ) {
folderImage = new ImageButton();
folderImage.ImageUrl = "/images/newfolder.gif";
folderImage.ToolTip = "Creates a new client folder";
folderImage.AlternateText = "Creates a new client folder";
folderImage.BorderStyle = BorderStyle.None;
folderImage.Width = 16;
folderImage.Height = 16;
folderImage.CommandName = "AddClientFolderClick";
this.Controls.Add( folderImage );

this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );

folderLink = new LinkButton();
folderLink.Text = "Make a new client folder";
folderLink.ToolTip = "Creates a new client folder";
folderLink.CommandName = "AddClientFolderClick";
this.Controls.Add ( folderLink );
} else {
folderImage = new ImageButton();
folderImage.ImageUrl = "/images/newfolder.gif";
folderImage.ToolTip = "Creates a new folder";
folderImage.AlternateText = "Creates a new folder";
folderImage.BorderStyle = BorderStyle.None;
folderImage.Width = 16;
folderImage.Height = 16;
folderImage.CommandName = "AddFolderClick";
this.Controls.Add( folderImage );

this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );

folderLink = new LinkButton();
folderLink.Text = "Make a new folder";
folderLink.ToolTip = "Creates a new folder";
folderLink.CommandName = "AddFolderClick";
this.Controls.Add ( folderLink );
}

this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );

if ( this.NewFolder ) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td colspan=\"2\">\n" ) );

this.Controls.Add( new LiteralControl( "<input type=text>" ) );

this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );
}
}

if ( this.UploadFile && FolderPath != "/" ) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td>\n" ) );

fileImage = new ImageButton();
fileImage.ImageUrl = "/images/uploadfile.gif";
fileImage.ToolTip = "Upload a new file";
fileImage.AlternateText = "Upload a new file";
fileImage.BorderStyle = BorderStyle.None;
fileImage.Width = 16;
fileImage.Height = 16;
fileImage.CommandName = "UploadFileClick";
this.Controls.Add( fileImage );

this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );

fileLink = new LinkButton();
fileLink.Text = "Upload a new file";
fileLink.ToolTip = "Upload a new file";
fileLink.CommandName = "UploadFileClick";
this.Controls.Add ( fileLink );
this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );
}

if ( this.EditUsers && FolderPath != "/" ) {
this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n<td>\n" ) );

userImage = new ImageButton();
userImage.ImageUrl = "/images/editusers.gif";
userImage.ToolTip = "Edit user access";
userImage.AlternateText = "Edit user access";
userImage.BorderStyle = BorderStyle.None;
userImage.Width = 16;
userImage.Height = 16;
userImage.CommandName = "EditUsersClick";
this.Controls.Add( userImage );

this.Controls.Add( new LiteralControl( "\n</td>\n<td>\n" ) );

userLink = new LinkButton();
userLink.Text = "Edit user access";
userLink.ToolTip = "Edit user access";
userLink.CommandName = "EditUsersClick";
this.Controls.Add ( userLink );
this.Controls.Add( new LiteralControl( "</td>\n</tr>\n" ) );
}

this.Controls.Add( new LiteralControl( "</table>\n<br />\n" ) );
}

this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + (Width - 20) + ";\">\n" ) );

this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">Details</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );

this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n" ) );

if ( FolderPath == "/" ) {
this.Controls.Add( new LiteralControl( "<td>Root<br />\nFile Folder<br /><br/>Date Modified: " + String.Format( "{0:dd MMMM yyyy, HH:mm}", Directory.GetLastWriteTime( Page.MapPath( "/files" + FolderPath ) ) ) + "</td>\n</tr>\n" ) );
} else {
this.Controls.Add( new LiteralControl( "<td>" + FolderName + "<br />\nFile Folder<br /><br/>Date Modified: " + String.Format( "{0:dd MMMM yyyy, HH:mm}", Directory.GetLastWriteTime( Page.MapPath( "/files" + FolderPath ) ) ) + "</td>\n</tr>\n" ) );
}

this.Controls.Add( new LiteralControl( "</table>\n" ) );
} else {
this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + (Width - 20) + ";\">\n" ) );

this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">Details</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );

this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n" ) );
this.Controls.Add( new LiteralControl( "<td><b style=\"color: red;\">Error: Folder not found!</b></td>\n</tr>\n" ) );

this.Controls.Add( new LiteralControl( "</table>\n" ) );
}
} else {
this.Controls.Add( new LiteralControl( "<table cellpadding=\"4\" cellspacing=\"0\" style=\"border: 1px solid #D4D0C8; width: " + (Width - 20) + ";\">\n" ) );

this.Controls.Add( new LiteralControl( "<tr>\n" ) );
this.Controls.Add( new LiteralControl( "<th style=\"font-family: Arial; font-size: 8pt; font-weight: bold; color: black; text-align: left; background-color: #D4D0C8;\">Details</th>\n" ) );
this.Controls.Add( new LiteralControl( "</tr>\n" ) );

this.Controls.Add( new LiteralControl( "<tr style=\"background-color: #FFFFFF;\">\n" ) );
this.Controls.Add( new LiteralControl( "<td><b style=\"color: red;\">Error: No folder specified!</b></td>\n</tr>\n" ) );

this.Controls.Add( new LiteralControl( "</table>\n" ) );
}
this.Controls.Add( new LiteralControl( "</div>\n" ) );
}

protected override bool OnBubbleEvent( object source,
EventArgs e )
{
bool handled = false;

if (e is CommandEventArgs) {
CommandEventArgs ce = (CommandEventArgs)e;
if (ce.CommandName == "FolderUpClick") {
OnFolderUpClick(ce);
handled = false;
} else if (ce.CommandName == "AddFolderClick") {
OnAddFolderClick(ce);
handled = false;
} else if (ce.CommandName == "UploadFileClick") {
OnUploadFileClick(ce);
handled = false;
} else if (ce.CommandName == "EditUsersClick") {
OnEditUsersClick(ce);
handled = false;
} else if (ce.CommandName == "AddClientFolderClick") {
OnAddClientFolderClick(ce);
handled = false;
}
}

return handled;
}

protected virtual void OnFolderUpClick (EventArgs e)
{
if (FolderUpClick != null) {
FolderUpClick(this,e);
}
}

protected virtual void OnAddFolderClick (EventArgs e)
{
if (AddFolderClick != null) {
AddFolderClick(this,e);
}
}

protected virtual void OnUploadFileClick (EventArgs e)
{
if (UploadFileClick != null) {
UploadFileClick(this,e);
}
}

protected virtual void OnEditUsersClick (EventArgs e)
{
if (EditUsersClick != null) {
EditUsersClick(this,e);
}
}

protected virtual void OnAddClientFolderClick (EventArgs e)
{
if (AddClientFolderClick != null) {
AddClientFolderClick(this,e);
}
}

public string FolderPath {
get
{
string f = (string) ViewState["FolderPath"];

return ( f == null ) ? String.Empty : (string) f;
}
set
{
ViewState["FolderPath"] = value;

this.SplitPath = value.Split( new char[] {'/'} );
}
}

protected string[] SplitPath {
get
{
object obj = ViewState["SplitPath"];

return (obj == null) ? new string[0] : (string[]) ViewState["SplitPath"];
}
set
{
ViewState["SplitPath"] = value;

this.FolderName = value[ value.Length - 1 ];
}
}

protected string FolderName {
get
{
string f = (string) ViewState["FolderName"];

return ( f == null ) ? String.Empty : (string) f;
}
set
{
ViewState["FolderName"] = value;
}
}

public bool NewFolder {
get
{
object obj = ViewState["NewFolder"];

return (obj == null) ? false : (bool) ViewState["NewFolder"];
}
set
{
ViewState["NewFolder"] = value;
}
}

public bool AddFolder {
get
{
object obj = ViewState["AddFolder"];

return (obj == null) ? false : (bool) ViewState["AddFolder"];
}
set
{
ViewState["AddFolder"] = value;
}
}

public bool UploadFile {
get
{
object obj = ViewState["UploadFile"];

return (obj == null) ? false : (bool) ViewState["UploadFile"];
}
set
{
ViewState["UploadFile"] = value;
}
}

public bool EditUsers {
get
{
object obj = ViewState["EditUsers"];

return (obj == null) ? false : (bool) ViewState["EditUsers"];
}
set
{
ViewState["EditUsers"] = value;
}
}

public int Width {
get
{
object obj = ViewState["Width"];

return (obj == null) ? 183 : (int) ViewState["Width"];
}
set
{
ViewState["Width"] = value;
}
}

public int Height {
get
{
object obj = ViewState["Height"];

return (obj == null) ? 400 : (int) ViewState["Height"];
}
set
{
ViewState["Height"] = value;
}
}

public int Left {
get
{
object obj = ViewState["Left"];

return (obj == null) ? 0 : (int) ViewState["Left"];
}
set
{
ViewState["Left"] = value;
}
}

public int Top {
get
{
object obj = ViewState["Top"];

return (obj == null) ? 0 : (int) ViewState["Top"];
}
set
{
ViewState["Top"] = value;
}
}

public PositionEnum Position {
get
{
object obj = ViewState["Position"];

return (obj == null) ? PositionEnum.None : (PositionEnum) obj;
}
set
{
ViewState["Position"] = value;
}
}
}


Any help would be appreciated.

DJ
master4eva
Asp.Net User
Re: Composite Control Problem with Bubble Events3/16/2004 1:54:13 PM

0/0

Ah - you know what the problem is: call the EnsureChildControls method like so in your OnBubble method:

protected override bool OnBubbleEvent( object source, EventArgs e ) {
bool handled = false;
EnsureChildControls();

if (e is CommandEventArgs) {
// ...
}
}

-- Justin Lovell
dj4uk
Asp.Net User
Re: Composite Control Problem with Bubble Events3/16/2004 2:07:55 PM

0/0

I added that call to all OnBubbleEvents - but it made no difference :(
11 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:

Web:
Composite Control - Events in Child aren't Bubbled : event ... I have not been able to capture any fired events from the Tab objects, so I've simplified the problem down to the most basic Parent/Child composite control, ...
Inside Microsoft: Making a Composite Control with ASP.NET NET server controls that combine to form a composite control become the child .... A control can participate in event bubbling through two methods that it ...
July 2006 - Posts - Brian Mains Blog The returned value determines whether to keep raising the bubble event. .... I had a problem with a composite control I was building; I tried several ways ...
Custom AJAX Client Control using CompositeControl - ASP.NET Forums I am thinking I need to bubble up the onclick event of the radiobuttonlist to the composite control level? Any advice? Thanks in advance. ...
Firing events from child controls in a Web Custom Control someone else is having problems with this: A composite control must do the ... Note that you can bubble events from the child controls ...
CodeProject: Managing ViewState, Rendering and Events in Composite ... got problem with my composite custom web control.. I have custom datagrid control within .... Bubble this event to parent. RaiseBubbleEvent(this, e); ...
UserControls and Collections Property 1) A Tab control (I created as CompositeControl consisting of just pretty .... Problem in handling events of composite controls. ...
using Windows API in VB.Net? - .NET VB event)--->CompositeControl--->--- (bubbling event)--->Form we get Control----> Form (making maintenance a breeze) The next problem is doing ...
Composite Server Control raises events internally but not to the ... I create linkbuttons which bubble their click event up to the horizontalwizard composite control. It works fine, the activeindex changes ...
Server Control Events named SuperButton. This section examinesCommand events and event bubbling with an example. composite control to demonstrate these concepts. ...




Search This Site:










templated control examples ?

how can i convert a page aspx in a custom control?

building and retrieving dynamic control values

multiple hostheaders in shared hosting

textalign for textbox

how can i call web-form method from usercontrol?

referencing class from string

sorting a hybriddictionary?

custom control databinding?

ipostbackeventhandler and ipostbackdatahandler

postback data not loaded

set and get viewstate properties

xml feed for a asp .net custom control

urgent button event never fires

sometimes i got an error message with my control.

http://www.vwdhosting.net mail problem

component as a control property

handling <% %> code blocks in customer server controls

searchresult.properties("????")

custom designers for .net components

custom control question, please help

is there any attribute to indicate required property?

alignment of control when cssclass is set

plz advise: max $20

button in user control not firing event

setting properties of a custom web control

viewstate in composite controls

server control not able to drag and drop

book question

compliance checking / the verificationattribute

  Privacy | Contact Us
All Times Are GMT