471,330 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,330 software developers and data experts.

LINQ and dropdownlists

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_DataBound(object sender, EventArgs e)
{
DropDownList ddl = sender as DropDownList;
foreach (StatData sd in StatData)
{

ddl.Items.Remove(ddl.Items.FindByValue(sd.Statisti cName));
}
}

I feel like it should be done with filtering somehow but am unsure.
Thanks for any help!
Jun 27 '08 #1
0 751

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Steve Caliendo | last post: by
reply views Thread by Carlos | last post: by
9 posts views Thread by =?Utf-8?B?cmF1bGF2aQ==?= | last post: by
reply views Thread by =?Utf-8?B?SHlwZXJjb2Rlcg==?= | last post: by
3 posts views Thread by =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.