Cross Page Posting using public property on previous page

Discussion in 'ASP .Net' started by =?Utf-8?B?dGhlV2l6YXJkMQ==?=, Apr 20, 2006.

  1. Using Visual Studio.Net 2005, Asp.Net 2.0, and trying to use technique shown
    in the Programming Asp.Net 3rd Edition by O'Reily, page 257.

    On the first page, this would become the previous page, I have 2 dropdowns.
    According to their technique, I should create a public property on my
    previous page for these 2 dropdowns, and then I would would be able to get
    their settings on the target aspx page.

    I have added the 2 properties on the previous page:

    public DropDownList ddlMonth
    {
    get { return ddlMonth; }
    }

    public DropDownList ddlYear
    {
    get { return ddlYear; }
    }

    However, I get an errors showing:
    The type "gives me my page name" already contains a definition for ddlMonth.
    The type "gives me my page name" already contains a definition for ddlYear.

    I would really like to use this technique. Please help.
    =?Utf-8?B?dGhlV2l6YXJkMQ==?=, Apr 20, 2006
    #1
    1. Advertising

  2. Further info regarding my previous page:

    It contains these 2 methods:

    protected void ddlMonth_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void ddlYear_SelectedIndexChanged(object sender, EventArgs e)
    {

    }

    Do I need to make these public? Is this causing any conflicts?

    Please any assistance regarding how to use the public property get for
    controls when using Cross Page Posting, or Response.Redirect or
    Server.Transfer would be appreciated. I preferred using the property get
    because it avoid having to pass anything on a querystring, or having to have
    a hidden field.

    "theWizard1" wrote:

    > Using Visual Studio.Net 2005, Asp.Net 2.0, and trying to use technique shown
    > in the Programming Asp.Net 3rd Edition by O'Reily, page 257.
    >
    > On the first page, this would become the previous page, I have 2 dropdowns.
    > According to their technique, I should create a public property on my
    > previous page for these 2 dropdowns, and then I would would be able to get
    > their settings on the target aspx page.
    >
    > I have added the 2 properties on the previous page:
    >
    > public DropDownList ddlMonth
    > {
    > get { return ddlMonth; }
    > }
    >
    > public DropDownList ddlYear
    > {
    > get { return ddlYear; }
    > }
    >
    > However, I get an errors showing:
    > The type "gives me my page name" already contains a definition for ddlMonth.
    > The type "gives me my page name" already contains a definition for ddlYear.
    >
    > I would really like to use this technique. Please help.
    >
    >
    =?Utf-8?B?dGhlV2l6YXJkMQ==?=, Apr 20, 2006
    #2
    1. Advertising

  3. If the property is the same as the name of the dropdownlist , the compiler
    is going to complain.

    Your [PageName].aspx.designer.cs class will have the dropdownlist defined,
    if you want to expose the ddl as a property simply
    use a different name

    Hope this helps!
    Swanand


    --
    Swanand Mokashi
    Microsoft Certified Solution Developer (.NET) - Early Achiever
    Microsoft Certified Application Developer (.NET)

    http://www.dotnetgenerics.com/
    DotNetGenerics.com -- anything and everything about Microsoft .NET
    technology ...

    http://www.swanandmokashi.com/
    http://www.swanandmokashi.com/HomePage/WebServices/
    Home of the Stock Quotes, Quote of the day and Horoscope web services



    "theWizard1" <> wrote in message
    news:...
    > Using Visual Studio.Net 2005, Asp.Net 2.0, and trying to use technique
    > shown
    > in the Programming Asp.Net 3rd Edition by O'Reily, page 257.
    >
    > On the first page, this would become the previous page, I have 2
    > dropdowns.
    > According to their technique, I should create a public property on my
    > previous page for these 2 dropdowns, and then I would would be able to get
    > their settings on the target aspx page.
    >
    > I have added the 2 properties on the previous page:
    >
    > public DropDownList ddlMonth
    > {
    > get { return ddlMonth; }
    > }
    >
    > public DropDownList ddlYear
    > {
    > get { return ddlYear; }
    > }
    >
    > However, I get an errors showing:
    > The type "gives me my page name" already contains a definition for
    > ddlMonth.
    > The type "gives me my page name" already contains a definition for
    > ddlYear.
    >
    > I would really like to use this technique. Please help.
    >
    >
    Swanand Mokashi, Apr 20, 2006
    #3
    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. Charles A. Lackman
    Replies:
    1
    Views:
    1,298
    smith
    Dec 8, 2004
  2. SpamProof
    Replies:
    0
    Views:
    522
    SpamProof
    Oct 21, 2003
  3. Kevin Spencer
    Replies:
    2
    Views:
    3,284
    Kevin Spencer
    Sep 15, 2004
  4. bill
    Replies:
    6
    Views:
    9,078
  5. YankeeImperialistDog
    Replies:
    3
    Views:
    818
Loading...

Share This Page