Cross Page Posting using public property on previous page

G

Guest

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.
 
G

Guest

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.
 
S

Swanand Mokashi

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top