I have a dropdownlist control that is populated when a page loads by its own datasource. Also on the page is a gridview that shows records that are already in a given table.
In edit mode of the gridview, there is another dropdownlist which shows the same available records as the dropdownlist at the top of the page.
When I edit a record in the girdview and select a record from the ddl in the row being edited, I try to rebind the ddl at the top of the page, but it still includes the original record that was added to the gridview record that was just edited.
When I binddata() to the gridview, it doubles all of the records.
How can I remove the record from the ddl at the top of the page?
Below this control which is used for adding items to a gridview lower on tagj
I believe 3rd link may give you a better direction. Please pay attention to the usage of DataKeyNames property along with the OnRowUpdated and OnRowDeleted events.
march11
Contributor
3001 Points
1361 Posts
dropdownlist update when gridview is updated.
Dec 14, 2012 04:11 PM|LINK
I have a dropdownlist control that is populated when a page loads by its own datasource. Also on the page is a gridview that shows records that are already in a given table.
In edit mode of the gridview, there is another dropdownlist which shows the same available records as the dropdownlist at the top of the page.
When I edit a record in the girdview and select a record from the ddl in the row being edited, I try to rebind the ddl at the top of the page, but it still includes the original record that was added to the gridview record that was just edited.
When I binddata() to the gridview, it doubles all of the records.
How can I remove the record from the ddl at the top of the page?
Below this control which is used for adding items to a gridview lower on tagj
oned_gk
All-Star
31465 Points
6423 Posts
Re: dropdownlist update when gridview is updated.
Dec 14, 2012 04:32 PM|LINK
march11
Contributor
3001 Points
1361 Posts
Re: dropdownlist update when gridview is updated.
Dec 14, 2012 05:13 PM|LINK
I need to append additional items. Setting this property to false will not work.
RameshRajend...
Star
7983 Points
2099 Posts
Re: dropdownlist update when gridview is updated.
Dec 14, 2012 05:26 PM|LINK
Following tutorials may help:
http://geekswithblogs.net/AzamSharp/archive/2008/05/22/122322.aspxhttp://authors.aspalliance.com/aspxtreme/webforms/controls/allowinguserstoeditrowsingridview.aspxhttp://csharpdotnetfreak.blogspot.com/2009/05/gridview-sqldatasource-insert-edit.html
I believe 3rd link may give you a better direction. Please pay attention to the usage of DataKeyNames property along with the OnRowUpdated and OnRowDeleted events.
march11
Contributor
3001 Points
1361 Posts
Re: dropdownlist update when gridview is updated.
Dec 14, 2012 05:41 PM|LINK
Turns out the solution was simple....
DropDownList4.Items.Remove(NewId)
DropDownList4.Items.Add(NewId)