本文发表在 rolia.net 枫下论坛for (int i = 0; i < ElementCount - 1; i++)
{
TableRow tr1 = new TableRow();
if (i < objProfiles.Profiles.get_Item(ref tempGlProfile).Elements.Count-1)
{
_Element = objProfiles.Profiles.get_Item(ref tempGlProfile).Elements.get_Item(ref tmpItem).Value;
Label label1 = new Label();
DropDownList DDL1 = new DropDownList();
ListBox ListBox1 = new ListBox();
label1.Text = _Element.Substring(6, _Element.Length - 6).Trim();
label1.Width = 100;
DDL1.Width = 300;
DDL1.Items.Add("Match Any Value");
DDL1.SelectedIndexChanged += new EventHandler(DDL1_SelectedIndexChanged);
Level = "0"+i;
DI.GetDictionaryLevelList(_YearPeriod.Substring(0, 4), 1 ,Level, Gl_Sec, Gl_Exclude,ref rsDI, ref _ErrorMsg);
if (!_ErrorMsg.Equals(""))
{
//put the error message into a label
}
else
{
if (rsDI.RecordCount != 0)
{
rsDI.MoveFirst();
while (rsDI.EOF == false)
{
DDL1.Items.Add(rsDI.Fields["DI_ACCT"].Value + " " + rsDI.Fields["DI_Desc"].Value);
rsDI.MoveNext();
}
}
DDL1.Text = DDL1.Items[0].Text;
}
TableCell tc1 = new TableCell();
tc1.Controls.Add(label1 );
tc1.Width = 150;
tr1.Cells.Add(tc1);
tc1 = new TableCell();
tc1.Controls.Add(DDL1);
tc1.Width = 300;
tr1.Cells.Add (tc1);
}
}
private void DDL1_SelectedIndexChanged(object sender, EventArgs e)
{
string SelectedElement = DDL1.SelectedItem.ToString ();
if (SelectedElement.Equals("Match Any Value"))
{
MyDynamicString += SelectedElement.Substring(0, 2);
}
}
The DDL1_SelectedIndexChanged never triggered. I don't know why.更多精彩文章及讨论,请光临枫下论坛 rolia.net
{
TableRow tr1 = new TableRow();
if (i < objProfiles.Profiles.get_Item(ref tempGlProfile).Elements.Count-1)
{
_Element = objProfiles.Profiles.get_Item(ref tempGlProfile).Elements.get_Item(ref tmpItem).Value;
Label label1 = new Label();
DropDownList DDL1 = new DropDownList();
ListBox ListBox1 = new ListBox();
label1.Text = _Element.Substring(6, _Element.Length - 6).Trim();
label1.Width = 100;
DDL1.Width = 300;
DDL1.Items.Add("Match Any Value");
DDL1.SelectedIndexChanged += new EventHandler(DDL1_SelectedIndexChanged);
Level = "0"+i;
DI.GetDictionaryLevelList(_YearPeriod.Substring(0, 4), 1 ,Level, Gl_Sec, Gl_Exclude,ref rsDI, ref _ErrorMsg);
if (!_ErrorMsg.Equals(""))
{
//put the error message into a label
}
else
{
if (rsDI.RecordCount != 0)
{
rsDI.MoveFirst();
while (rsDI.EOF == false)
{
DDL1.Items.Add(rsDI.Fields["DI_ACCT"].Value + " " + rsDI.Fields["DI_Desc"].Value);
rsDI.MoveNext();
}
}
DDL1.Text = DDL1.Items[0].Text;
}
TableCell tc1 = new TableCell();
tc1.Controls.Add(label1 );
tc1.Width = 150;
tr1.Cells.Add(tc1);
tc1 = new TableCell();
tc1.Controls.Add(DDL1);
tc1.Width = 300;
tr1.Cells.Add (tc1);
}
}
private void DDL1_SelectedIndexChanged(object sender, EventArgs e)
{
string SelectedElement = DDL1.SelectedItem.ToString ();
if (SelectedElement.Equals("Match Any Value"))
{
MyDynamicString += SelectedElement.Substring(0, 2);
}
}
The DDL1_SelectedIndexChanged never triggered. I don't know why.更多精彩文章及讨论,请光临枫下论坛 rolia.net