scrot
scrot

Reputation: 1647

C# - Any reason why this code would not function correctly?

For some reason, Section 1 works but Section 2 does not. When run in the opposite order (2 before 1), Section 1 (Affiliation) is not run at all. All the data is the same.

//Section 1

            UserService.DsUserAttributes dsAffiliation = us_service.GetUserAttributeDropDown(systemId, "Affiliation");
            Affiliation.DataSource = dsAffiliation.tblDropDownValues;
            Affiliation.DataTextField = "AttrValue";
            Affiliation.DataValueField = "Id";
            Affiliation.DataBind();                

//Section 2                 
            UserService.DsUserAttributes dsCountry = us_service.GetUserAttributeDropDown(systemId, "Country");
            Country.DataSource = dsCountry.tblDropDownValues;
            Country.DataTextField = "AttrValue";
            Country.DataValueField = "Id";
            Country.DataBind();

Upvotes: 0

Views: 184

Answers (2)

bdukes
bdukes

Reputation: 155895

It would certainly seem that either us_service.GetUserAttributeDropDown(systemId, "Country") or dsCountry.tblDropDownValues is throwing an exception. You'll need to walk through with the debugger to see which and why.

Upvotes: 2

Joachim Kerschbaumer
Joachim Kerschbaumer

Reputation: 9871

i guess this heavily depends on the "Country" and "Affiliation" objects...there could potentially happen anything. without any exceptions or something similar it's quite hard to remotely debugg this stuff ^^

Upvotes: 0

Related Questions