Wrox Programmer Forums
|
ASP.NET 1.x and 2.0 Application Design Application design with ASP.NET 1.0, 1.1, and 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.x and 2.0 Application Design 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
 
Old March 10th, 2005, 01:42 PM
Authorized User
 
Join Date: Dec 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default Cleaning a Place Holder from a class

Hello:
From a class I want clean a place holder contained in a web form.
I’m using this code:

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;


namespace WUC_CreDes
{
    public class Class1
    {
        public static bool Hay_PostBack()
        {
        WUC_CreDes.WebForm1 parent1 = (WUC_CreDes.WebForm1) this.Page;
        parent1.Example.Controls.Clear();
return false;
        }
    }
}

Where “Example” is my place holder within the web form.

When I compile my Project it’s sending me this error: “Keyword ‘this’ is not valid in a static property, a static method or as startup of static field”.

Does somebody has some idea about how can I attain it?

Thanks you in advance.

Greetings.

A.L.

El Hombre que tiene Amigos ha de mostrarse Amigo
__________________
El Hombre que tiene Amigos ha de mostrarse Amigo
 
Old March 11th, 2005, 06:34 PM
Authorized User
 
Join Date: Dec 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Finally I attained it thus:

In WebForm1 I did:

bool que = WUC_CreDes.Class1.Hay_PostBack(this);

And in my class I did:

public static bool Hay_PostBack(WUC_CreDes.WebForm1 parent1)
{
parent1.Example.Controls.Clear();
return false;
}

But now I need do same from a WUC, if I do:

bool que = WUC_CreDes.Class1.Hay_PostBack(this);

I understand I need replace 'this' with web form's name, here WebForm1.aspx

Somebody know how can I do to attain it?


El Hombre que tiene Amigos ha de mostrarse Amigo
 
Old March 14th, 2005, 12:09 PM
Authorized User
 
Join Date: Dec 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If I use: bool que = WUC_CreDes.Class1.Hay_PostBack(this.Page); it's sending me an error when I compile: Argument '1': it's not possible convert from 'System.Web.UI.Page' to 'WUC_CreDess.WebForm1'
May be I'm coding something wrongly but what?


El Hombre que tiene Amigos ha de mostrarse Amigo
 
Old March 15th, 2005, 01:49 AM
Friend of Wrox
 
Join Date: Jul 2004
Posts: 623
Thanks: 0
Thanked 1 Time in 1 Post
Default

I think you should cast 'System.Web.UI.Page' to 'WUC_CreDess.WebForm1' as the error informs
Code:
WUC_CreDes.Class1.Hay_PostBack((WUC_CreDess.WebForm1)this);
_____________
Mehdi.
software student.
 
Old March 15th, 2005, 12:28 PM
Authorized User
 
Join Date: Dec 2004
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks you Mehdi:
Finally I attained it changing de call function thus:

bool que = WUC_CreDes.Class1.Lanza(this.Page as WUC_CreDes.WebForm1);

Greetings.

A.L.


El Hombre que tiene Amigos ha de mostrarse Amigo





Similar Threads
Thread Thread Starter Forum Replies Last Post
Place Holder Manoj Bisht ASP.NET 1.x and 2.0 Application Design 3 October 24th, 2007 08:52 AM
Scrollbars for ContentPlace Holder??? sivavenu BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 1 August 23rd, 2007 04:40 AM
How to know if a place holder is empty see07 ASP.NET 1.x and 2.0 Application Design 2 March 4th, 2005 04:43 PM
Cleaning up resources jbenson001 ASP.NET 1.x and 2.0 Application Design 2 January 22nd, 2004 11:50 AM
Cleaning up data rlull SQL Server 2000 1 September 3rd, 2003 03:27 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.