Link to home
Start Free TrialLog in
Avatar of watherton
watherton

asked on

Property values

Hi Experts,

I have two drop down lists on one page, I have a base class that exposes properties for the form values so that they can be used throughout the request.

Here are the drop down selected index changed methods:


protected void ddProducts_Changed(object sender, EventArgs e)
        {
            if (int.Parse(ddProducts.SelectedItem.Value) == 0)
            {

            }
            else
            {
                BuildCardDesignDropDown(0,int.Parse(ddProducts.SelectedItem.Value),editCardDesign.ClientId);
            }
        }

        protected void ddClients_Changed(object sender, EventArgs e)
        {
            editCardDesign.ClientId = int.Parse(ddClients.SelectedItem.Value);
        }


when i put a watch on BuildCardDesignDropDown call, the editCardDesign.ClientId is 0, but the client drop down list appears before the card drop down list and therefore sets the editCardDesign.ClientId.

I believe this is being caused by the page posting a post back when the user selects a client (drop down), but I thought that setting my exposed property would then still be available later on.
ASKER CERTIFIED SOLUTION
Avatar of topdog770
topdog770
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of BBK_
BBK_

question is not well clear, cud u pls give more details....
Avatar of watherton

ASKER

sure...


user selects a client from the client dropdown list and sets a property of ClientId with the selected value. This property is in a class that is declared as follows:

CardDesign editCardDesign = new CardDesign.

Ok then the user has to select the Product, the BuildCardDesignDropDown method expects three params, these are used to populate another drop down list of CardDesigns.
However, when I pass editCardDesign.ClientID, which has been set by the client drop down selection, this value return 0.

Why is this?

Hope this is clear
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
great stuff. thanks for the reply