Hi Steve,
This particular application we're using VB.NET for the code behind language.
All of the code snippets I present here are from the web form which is the
target of the IFrame on the parent page.
In the page load event I have the following (this is all within a try-catch
block, which I've omitted for clarity's sake):
'now I have to build a SQL query using spNewVoucherServices20, to retrieve
data
SqlConnection1.ConnectionString = Session("ConnectionString").ToString()
'assign the connection string
SqlConnection1.Open()
ServicesForVoucher.Parameters("@ProviderNumber").V alue =
Convert.ToInt16(nProviderNumber)
ServicesForVoucher.Parameters("@VoucherNumber").Va lue = lVoucherNumber
ServicesForVoucher.Parameters("@ServiceCodeFilter" ).Value =
Convert.ToInt16(nServiceCodeFilter)
'fetch the data
daServicesForVoucher.Fill(DsServicesForVoucher1, "spNewVoucherServices20")
'bind it to the grid
DataGrid1.DataSource = DsServicesForVoucher1.spNewVoucherServices20
DataGrid1.DataBind()
(Please note that I do not consider postback in the page load event.
Basically I am thinking that I will always retrieve the data during each
postback.)
Then the code for the datagrid's delete command I have the following:
Try
DeleteService.Parameters("@ServiceID").Value = lServiceID
daServicesForVoucher.DeleteCommand.ExecuteNonQuery ()
cAmountExpended =
Convert.ToDecimal(DeleteService.Parameters("@Amoun tExpended").Value)
Catch ex As Exception
lblError.Text = ex.Message
lblError.Visible = True
End Try
daServicesForVoucher.Fill(DsServicesForVoucher1, "spNewVoucherServices20")
'refresh the data
DataGrid1.DataSource = DsServicesForVoucher1.spNewVoucherServices20
DataGrid1.DataBind() 'rebind after deleting the service
(Here you see that I am executing the DataBind() method of the datagrid
control, again. I thought this would work, even though it is called from
the page load event, because the datagrid's delete command event is fired
after the page load event.)
Rod
"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:g%****************@cpmsftngxa06.phx.gbl...
Hi Rod,
From your description, you used a webform datagrid to display some datas
retrieved from database and the datagrid contains a delete columns to
delete the items. When after the deleting, you update the dataset to
theserver and refill the dataset and bind to the grid again. However, you
found the delelted rows still exist on the datagrid, yes?
As you mentioned that you have checked that the dataset's data has
represnent the correct updated result( no deleted rows) ,yes? Then, I
think the problem is likely due to the rebinding of the datagrid. How do you
rebind the dataset to the datagrid? Maybe it is not correctly rebinded.
Please have a check on it and also it'll be better that you provide some
detailed code snip on this. Thank.s
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx