I have encountered an issue with two button click events - one is in Javascript and the other in VB. The first button (Javascript) retrieves values from various controls like textboxes and dropdown lists, while the second button (VB) saves these values to a SQL database. All controls, except for the Save button, do not trigger postbacks. However, when the second event is triggered, even if the values of all controls are changed, they revert back to their initial values from when the page was first loaded. I suspect this is due to the lack of a postback on the page.
Sample code in Javascript:
function btnget_click()
{
if(ddlccy.options[ddlccy.selectedIndex].value == "C1") //here ddlccy value is "c1" but the initial value on load is 'c17'
{
bmd = dsrt[0];
hbmd.value=dsrt[1];
}
}
Code in VB:
Private Sub txtpper1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtpper1.TextChanged
If ddlccy.SelectedValue = "C1" Or ddlccy.SelectedValue = "C5" Or ddlccy.SelectedValue = "C6" Or ddlccy.SelectedValue = "C12" Then 'ddlccy shows 'c17' and condition goes to else
'some code
Else
txtpfig.Text = Round(CDec(hbmd.Value) / CDec(txtpfig1.Text), Session("ratedis"))
End IF
End Sub
It seems that the controls' values manipulated through Javascript are not being retained. Is there a way to preserve these values?