loading dinamically webforms

Discussion in 'ASP .Net' started by =?Utf-8?B?am9zZXBt?=, Oct 7, 2005.

  1. Hello,
    My doubt is arround webforms and its load programatically. I have a class
    derived from System.Web.UI.Page (clsWebForm), with their own properties and
    methods. Inside another webform I instanciate clsWebForm, filling their
    properties, but how can I load the webform inside the web explorer?

    public class clsWebForm : System.Web.UI.Page
    {
    ....
    }

    In another page:

    private void cmdOk_Click(object sender, System.EventArgs e)
    {
    clsWebForm clsFrm = new clsWebFormt();
    // here I want to load the new web form bu I do not
    how!!!!
    }



    Thanks!
     
    =?Utf-8?B?am9zZXBt?=, Oct 7, 2005
    #1
    1. Advertising

  2. =?Utf-8?B?am9zZXBt?=

    Scott Allen Guest

    On Fri, 7 Oct 2005 06:51:03 -0700, josepm
    <> wrote:

    > private void cmdOk_Click(object sender, System.EventArgs e)
    > {
    > clsWebForm clsFrm = new clsWebFormt();
    > // here I want to load the new web form bu I do not
    >how!!!!
    > }
    >


    If you want to move processing to a second web form there are a few
    techniques that can work. There is Response.Redirect, Server.Transfer,
    and in 2.0 there is a cross page post back.

    I have an article on these topics here:
    http://odetocode.com/Articles/421.aspx

    What you don't want to do is create a webform with the new operator,
    as you really need ASP.NET's help to properly create and initialize a
    form and get it into the processing pipeline.

    HTH,

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/
     
    Scott Allen, Oct 7, 2005
    #2
    1. Advertising

  3. Thanks Scott, but I 'm deceived because I thought I could treat webForms as
    pure classes and manipulate so. So, I will use Response... and pass Request
    parameters until migrate to ASP 2.0.

    Best regards,

    josepm
     
    =?Utf-8?B?am9zZXBt?=, Oct 7, 2005
    #3
  4. =?Utf-8?B?am9zZXBt?=

    Scott Allen Guest

    Webforms are just classes, and you can technically new one up and
    manipulate it ... but ...

    To do this the right way you need the runtime to create and init the
    form via PageParser.GetCompiledPageInstance, because that method knows
    who to call for code-generation of the ASPX page, who to call to wire
    up implicit event handlers, and all the other "stuff" that needs to
    happen for a webform that is going to be part of an HTTP request and
    render to the client.

    --
    Scott
    http://www.OdeToCode.com/blogs/scott/


    On Fri, 7 Oct 2005 08:47:02 -0700, josepm
    <> wrote:

    >Thanks Scott, but I 'm deceived because I thought I could treat webForms as
    >pure classes and manipulate so. So, I will use Response... and pass Request
    >parameters until migrate to ASP 2.0.
    >
    >Best regards,
    >
    >josepm
     
    Scott Allen, Oct 7, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. JMMB

    Creating JavaScript Dinamically

    JMMB, Aug 26, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    432
    Kevin Spencer
    Aug 26, 2003
  2. Replies:
    2
    Views:
    399
  3. Leo sailer

    HowTo Loading ActiveX dinamically at runtime ?

    Leo sailer, Apr 27, 2005, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    239
    Leo sailer
    May 5, 2005
  4. Mahdi Haeri

    webforms reports throws error while loading

    Mahdi Haeri, May 29, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    149
    Mahdi Haeri
    May 29, 2006
  5. spallared

    Dinamically loading an image into a iframe

    spallared, Apr 26, 2007, in forum: Javascript
    Replies:
    1
    Views:
    118
    shimmyshack
    Apr 26, 2007
Loading...

Share This Page