S
S_K
Hi,
I have a list of 6 DropDownList boxes, from DropDownList1 to
DropDownList6, and I'm changing the SelectedIndex of each using a
foreach loop as follows:
foreach(PaymentReqDisplay thispayment in listPaymentReqDisplay)
{
if ((string)thispayment.TaxType == "FIT")
this.DropDownList1.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
if ((string)thispayment.TaxType == "FUI")
this.DropDownList2.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
if ((string)thispayment.TaxType == "SIT")
this.DropDownList3.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
if ((string)thispayment.TaxType == "SUI")
this.DropDownList4.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
if ((string)thispayment.TaxType == "ETF")
this.DropDownList5.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
if ((string)thispayment.TaxType == "SDI")
this.DropDownList6.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
}
The problem is that when I change, say, DropDownList4.SelectedIndex =
3; every other DropDownList's SelectedIndex changes as well!?
What am I doing wrong?
Thanks much for your help.
Steve
I have a list of 6 DropDownList boxes, from DropDownList1 to
DropDownList6, and I'm changing the SelectedIndex of each using a
foreach loop as follows:
foreach(PaymentReqDisplay thispayment in listPaymentReqDisplay)
{
if ((string)thispayment.TaxType == "FIT")
this.DropDownList1.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
if ((string)thispayment.TaxType == "FUI")
this.DropDownList2.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
if ((string)thispayment.TaxType == "SIT")
this.DropDownList3.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
if ((string)thispayment.TaxType == "SUI")
this.DropDownList4.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
if ((string)thispayment.TaxType == "ETF")
this.DropDownList5.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
if ((string)thispayment.TaxType == "SDI")
this.DropDownList6.SelectedIndex =
(int)thispayment.PaymentRequirementID - 1;
}
The problem is that when I change, say, DropDownList4.SelectedIndex =
3; every other DropDownList's SelectedIndex changes as well!?
What am I doing wrong?
Thanks much for your help.
Steve