jbulldoza
asked on
Update gridview with a button outside of the gridview
I have a gridview control where one of the columns contains a drop-down list box control. Outside of the gridview I have an Update button. I would like the OnClick event of the Update button to trigger an update but only for the rows where the drop-down value was changed.
Attached is my OnClick function so far. I know how to step through the rows in the gridview, I'm just not sure how to do my comparison.
Thanks.
Attached is my OnClick function so far. I know how to step through the rows in the gridview, I'm just not sure how to do my comparison.
Thanks.
Protected Sub btnUpdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpdate.Click
Try
For Each gv As GridViewRow In grdSearch.Rows
Dim ddlSelectedValue As DropDownList = CType(gv.FindControl("ddlAssignedTo"), DropDownList)
If ddlSelectedValue.SelectedValue <> Compare to What??? Then
'code to perform update here
End If
Next
Catch ex As Exception
End Try
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hidden field, brilliant. Thx.
Make sure you are not re-binding the dropdownlist on postback/callback
ASKER
Do I need to re-bind the grid and update my Update Panel?
grdSearch.DataBind()
UpdatePanelGrid.Update()