Wrox Programmer Forums
|
BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9
This is the forum to discuss the Wrox book Professional ASP.NET 3.5: In C# and VB by Bill Evjen, Scott Hanselman, Devin Rader; ISBN: 9780470187579
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET 3.5 : in C# and VB ISBN: 978-0-470-18757-9 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 February 16th, 2010, 12:55 PM
Authorized User
 
Join Date: Apr 2009
Posts: 48
Thanks: 16
Thanked 0 Times in 0 Posts
Default exposing server control from masterpage as public property

Hello there,

I have the scenerio where the content page is influenced from dropdownlists on the masterpage.
One of the ddl's becomes its data through code behind, like so
Code:
ddlType.DataSource = accTypeInTown;
            ddlType.Items.Add("select type");
            ddlType.DataTextField = "Name";
            ddlType.DataValueField = "Id";
            ddlType.DataBind();
this databinding takes places in the SelectedIndexChanged of another ddl, to filter its values.

To access these ddls on a content page, I created public properties for them in the masterpage.cs, like so
Code:
    public DropDownList MPddlTown
    {
        get
        {
            return ddlTown;
        }
        set
        {
            ddlTown = value;
        }
    }
    public DropDownList MPddlType
    {
        get
        {
            return ddlType;
        }
        set
        {
            ddlType = value;
        }
However if I now try to load the page in the browser, I get the following error: Input string was not in a correct format.

pointing to the code-line ddlType.DataBind();

How can this be, before declaring the public ddl properties it worked fine...?

Does anybody have any suggestions?

Thanks in advance, Robin





Similar Threads
Thread Thread Starter Forum Replies Last Post
Access MasterPage control in contentpage bhadrinath.medi ASP.NET 2.0 Professional 1 November 10th, 2009 05:23 PM
Server side on code on control property jayaraj123 ASP.NET 2.0 Professional 1 May 23rd, 2007 08:30 AM
text-property in a non-server control propellis .NET Web Services 0 July 4th, 2006 03:29 AM
Saving a Public Property created in App_Code striker9 ASP.NET 2.0 Basics 1 June 8th, 2006 02:18 PM
Chapter 13, can not visit the public property Artistry BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 2 August 25th, 2005 02:16 AM





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