Hi there,
I just started working with Linq and am having trouble with adding and
removing items from a dropdownlist. The dropdownlist is bound to a
LinqDataSource. On the form is a gridview that lists some statistics
for a product and a value for each stat line. There is also an Add
statistic line in the template footer with a dropdownlist that should
have any statistics not currently associated with the product. I can
make that work but what I am having issue with is what to do if a
Statistic line is deleted but the data has not actually been updated
yet...how do I remove the Statistic value from the dropdownlist if the
database hasn't been impacted yet? I tried this and nothing happens.
protected void DropDownList1_D ataBound(object sender, EventArgs e)
{
DropDownList ddl = sender as DropDownList;
foreach (StatData sd in StatData)
{
ddl.Items.Remov e(ddl.Items.Fin dByValue(sd.Sta tisticName));
}
}
I feel like it should be done with filtering somehow but am unsure.
Thanks for any help!
I just started working with Linq and am having trouble with adding and
removing items from a dropdownlist. The dropdownlist is bound to a
LinqDataSource. On the form is a gridview that lists some statistics
for a product and a value for each stat line. There is also an Add
statistic line in the template footer with a dropdownlist that should
have any statistics not currently associated with the product. I can
make that work but what I am having issue with is what to do if a
Statistic line is deleted but the data has not actually been updated
yet...how do I remove the Statistic value from the dropdownlist if the
database hasn't been impacted yet? I tried this and nothing happens.
protected void DropDownList1_D ataBound(object sender, EventArgs e)
{
DropDownList ddl = sender as DropDownList;
foreach (StatData sd in StatData)
{
ddl.Items.Remov e(ddl.Items.Fin dByValue(sd.Sta tisticName));
}
}
I feel like it should be done with filtering somehow but am unsure.
Thanks for any help!