I have this code on my asp.net page in page load event:
and this javascript code:vb.net Code:
If Not IsPostBack Then recordId = Request.QueryString("rid") myRecord = GetRecord(recordId) If myRecord Is Nothing Then ShowErrorMessage("Record not found!") ' pnlMainBody.Visible = False Exit Sub End If ViewState("RecordId") = recordId Else recordId = ViewState("RecordId").ToString End If
javascript Code:
function GotoRecord() { var tb = document.getElementById('txtRecordNumber'); if (isNaN(tb.value) || tb.value.indexOf('.') >= 0) { tb.focus(); alert("Enter valid Record Number."); } else window.location = 'ShowRecord.aspx?rid=' + tb.value; }
It works fine until the "pnlMainBody.Visible = False" is commented out and shows the message ""Record not found!" correctly. But if I uncomment that line, it believes that it is a postback and enters the ELSE block and errors out, when user enters some record number in the textbox and hits enter (it executes the javascript code)
Any ideas?

