Hi
Me again....I've got a datagrid that is essentially a calendar. Within each cell I have a button that allows an event to be booked. When the button is clicked a confirmation screen appears which is a form within a div tag. When the user is happy with the information being booked, it is written to the database and the calendar grid is refreshed. However.....after the data is written to the database the grid I'm calling the databind function which for some reason is not clearing down the existing grid and just tacking the new grid onto the existing one.
I've tried setting the datasource to nothing before rebinding but no joy.
Please can anyone help as this is driving me mad!
Cheers
Lbob
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Page.IsPostBack = False Then
RdbYes.Attributes.Add("OnClick", "RdbYes_Click();")
RdbNo.Attributes.Add("OnClick", "RdbNo_Click();")
End If
bindData(sDate)
End Sub
Private Sub bindData(sDate as string)
Dim ds As DataSet,dt As New DataTable("Tbl"),dv As DataView
Dim i As Int32, c As Int32, r As Int32, k As Int32
ds = ListCalendar(sDate)
.....omitted the setting of dt for space reasons
GrdData.DataSource = dt
GrdData.DataBind()
ds.Dispose()
dt.Dispose()
End Sub
Private Sub btnConfirmOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnConfirmOK.Click
....write back to db
.....then rebind datagrid
divConfirmation.Style.Item("display") = "none"
DivShim.Style.Item("display") = "none"
GrdData.DataSource = nothing
GrdData.databind
bindData(sDate)
End Sub
Me again....I've got a datagrid that is essentially a calendar. Within each cell I have a button that allows an event to be booked. When the button is clicked a confirmation screen appears which is a form within a div tag. When the user is happy with the information being booked, it is written to the database and the calendar grid is refreshed. However.....after the data is written to the database the grid I'm calling the databind function which for some reason is not clearing down the existing grid and just tacking the new grid onto the existing one.
I've tried setting the datasource to nothing before rebinding but no joy.
Please can anyone help as this is driving me mad!
Cheers
Lbob
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Page.IsPostBack = False Then
RdbYes.Attributes.Add("OnClick", "RdbYes_Click();")
RdbNo.Attributes.Add("OnClick", "RdbNo_Click();")
End If
bindData(sDate)
End Sub
Private Sub bindData(sDate as string)
Dim ds As DataSet,dt As New DataTable("Tbl"),dv As DataView
Dim i As Int32, c As Int32, r As Int32, k As Int32
ds = ListCalendar(sDate)
.....omitted the setting of dt for space reasons
GrdData.DataSource = dt
GrdData.DataBind()
ds.Dispose()
dt.Dispose()
End Sub
Private Sub btnConfirmOK_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnConfirmOK.Click
....write back to db
.....then rebind datagrid
divConfirmation.Style.Item("display") = "none"
DivShim.Style.Item("display") = "none"
GrdData.DataSource = nothing
GrdData.databind
bindData(sDate)
End Sub