diff --git a/CH78/Display.aspx.cs b/CH78/Display.aspx.cs index 54a2fe8..7800895 100644 --- a/CH78/Display.aspx.cs +++ b/CH78/Display.aspx.cs @@ -13,8 +13,8 @@ namespace CH78 { string studentID = ""; string gender; + string id = StudentDataTier.DecryptQueryString(Request.QueryString["ID"], "CNSAcnsa1", "salty").Trim('\0'); - string id = StudentDataTier.DecryptQueryString(Request.QueryString["ID"], "CNSAcnsa1", "salty"); if (!IsPostBack) { @@ -27,7 +27,7 @@ namespace CH78 Response.Redirect("Home.aspx"); } - else if (id.ToUpper() == "NEW") + else if (id.ToUpper().Trim() == "NEW") { BindDDL(); } diff --git a/CH78/Home.aspx.cs b/CH78/Home.aspx.cs index 6df7a3e..13713a9 100644 --- a/CH78/Home.aspx.cs +++ b/CH78/Home.aspx.cs @@ -265,9 +265,10 @@ namespace CH78 protected void btnNew_OnClick(object sender, EventArgs e) { - string recordToBeEdited; + string recordToBeEdited = "NEW"; Int64 mEditedRecord = 0; System.Text.StringBuilder sb = new System.Text.StringBuilder(); + recordToBeEdited = StudentDataTier.EncryptQueryString(recordToBeEdited, "CNSAcnsa1", "salty"); try { @@ -277,7 +278,7 @@ namespace CH78 // this script will open a popup sb.Append("");