I currently have a gridView (gv_news) and a detailsView, the gridView shows a list of news items, with an alternatingRowStyle backColor of Grey and Transparent. The gridView also has a selectedRowStyle backColor of green:
<SelectedRowStyle BackColor="#CCFFCC" />
<AlternatingRowStyle BackColor="#EFEFEF" />
Now when I select an item in the grid view the item turns green, once I update the item or cancel the update in the detailsView I would like the selectedRowStyle in the gridView to be reset to the default alternatingRowStyle - as if nothing is selected any more.
I have created a function which I have bound the the detailsViews Update and Cancel buttons as show below. The error I receive, when one of these buttons is clicked is:
ion: Object reference not set to an instance of an object.
I would appreciate some assistance in resolving this.
Dim gv_news As GridView = CType(Page.FindControl("gv_news"), GridView)
gv_news.SelectedRow.BackColor = Drawing.Color.Transparent