Does this look ok to use? I'm trying to make sure there is nothing in the hidden field and txt boxes prior to making the request fro the querystrings.
I have this in my page load event
If Not Page.IsPostBack Then
'clear all fields here then set them below, just to be sure they start out blank.
hfClient_ID.Value = DBNull.Value.ToString
hfAccount_ID.Value = DBNull.Value.ToString
hfEmail.Value = DBNull.Value.ToString
hfEmail.Value = DBNull.Value.ToString
txtFirstName.Text = ""
txtLastName.Text = ""
'load fields for the Client
hfClient_ID.Value = Request.QueryString("Client_ID")
hfAccount_ID.Value = Request.QueryString("Account_ID")
hfEmail.Value = Request.QueryString("Email")
txtEmail.Text = hfEmail.Value
txtFirstName.Text = Request.QueryString("FirstName")
txtLastName.Text = Request.QueryString("LastName")
On initial load of the page the controls will be empty, no? What I'm saying, there's no need for the clear part.
You don't need to check it at first load, it's already blank
Below is a sample hiddenfield that already has a value at first load
You only need to check the query string to avoid error
If Request.QueryString("Client_ID") IsNot Nothing Then
hfClient_ID.Value = Request.QueryString("Client_ID")
End If
沒有留言:
張貼留言