right now I have a label that updates the time and date when it is modified, however, the modified date and time wont show until i exit out and go back into that account....how do i fix this so it shows modified date as soon as it saves?
'Convert From Date and Time to just Date--------------------------------------------------------
Dim modifieddate As String = String.Format("{0:MM/dd/yy}", Convert.ToDateTime(dr2.Item(22)))
'Convert From Date and Time to just Time
Dim modifiedtime As String = String.Format("{0:hh:mm:ss tt}", Convert.ToDateTime(dr2.Item(23)))
'Modified Date and Time
lblmodified.Text = (modifieddate.ToString + (" " + modifiedtime.ToString))
'------------------------------------------------------------------------------------------------
'Update
Sqlupdate.UpdateCommand = "UPDATE LOCATIONS Set STATE = '" & ddlstate.Text & "', MDDT = '" & Today & "', MDTM = '" & TimeOfDay & "' where LOCATIONID = '" & txtlocationid.Text & "'"
Sqlupdate.Update()
re-query your data After you do the update
how do i do that?
Are you binding something to a sql data source? If so then you just call the control.bind()
If not there must be some code that querys the data and set's the value in the controls.... perhaps in your page load? If so move that to a sub and call it from both the page load and after you update.
Some pseudo code might be:
Sub PageLoad()
If not IsPostback
BindData()
End If
End Sub
Sub BindData()
'Bind code here
End Sub
Sub ButtonClick()
Update
BindData()
End Sub
Where you show the modified date? Rebind it just after you call update
沒有留言:
張貼留言