0
我有一個帶有編輯/更新命令按鈕的gridview。我正在使用下拉菜單爲gridview數據源(ds2)設置selectcommand,如下所示。Gridview更新後沒有綁定
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
If ddFilter.SelectedValue = "Title" Then ds2.SelectCommand = "SELECT * FROM [contentStore] WHERE ([Title] LIKE '%' + @Title + '%') order by [Title] asc"
If ddFilter.SelectedValue = "URL" Then ds2.SelectCommand = "SELECT * FROM [contentStore] WHERE ([URL] LIKE '%' + @Title + '%') order by [URL] asc"
If ddFilter.SelectedValue = "ID" Then ds2.SelectCommand = "SELECT * FROM [contentStore] WHERE ([ID] LIKE '%' + @Title + '%') order by [ID] asc"
GridView1.DataBind()
Catch ex As Exception
lblFilter.Text = "<h3>Filter Issue</h3>" & ex.ToString
End Try
End Sub
麻煩的是,當我使用編輯/更新組合正確但在GridView不會再次結合本身的記錄被更新。如果我再次按下按鈕,gridview會反彈,顯示更新後的數據。
我的問題是如何能得到GridView控件本身更新後綁定
發佈編輯/更新命令的代碼。 –
您是否嘗試在'row_command'事件處理程序結束時重新綁定? –