protected void btnAdd_Click(Object Sender, EventArgs e) { if (Request.Form[hdnId.UniqueID] == "0") { oVirtualHDD.Add(txtName.Text, double.Parse(txtValue.Text), (chkVMware.Checked ? 1 : 0), (chkVirtual.Checked ? 1 : 0), (chkXP.Checked ? 1 : 0), (chkWin7.Checked ? 1 : 0), (chkDefault.Checked ? 1 : 0), txtPrompt.Text, (oVirtualHDD.Gets(0).Tables[0].Rows.Count + 1), (chkEnabled.Checked ? 1 : 0)); } else { oVirtualHDD.Update(Int32.Parse(Request.Form[hdnId.UniqueID]), txtName.Text, double.Parse(txtValue.Text), (chkVMware.Checked ? 1 : 0), (chkVirtual.Checked ? 1 : 0), (chkXP.Checked ? 1 : 0), (chkWin7.Checked ? 1 : 0), (chkDefault.Checked ? 1 : 0), txtPrompt.Text, (chkEnabled.Checked ? 1 : 0)); } if (Request.Form[hdnOrder.UniqueID] != "") { string strOrder = Request.Form[hdnOrder.UniqueID]; int intCount = 0; while (strOrder != "") { intCount++; int intId = Int32.Parse(strOrder.Substring(0, strOrder.IndexOf("&"))); strOrder = strOrder.Substring(strOrder.IndexOf("&") + 1); oVirtualHDD.UpdateOrder(intId, intCount); } } Response.Redirect(Request.Path); }