protected void btnsubmit_Click(object sender, EventArgs e)
 {
     if (txtname.Text.ToString().Trim() != string.Empty)
     {
         statemaster state = new statemaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
         state.statemaster_STATEID = -1;
         state.statemaster_STATENAME = txtname.Text.ToString().Trim();
         state.statemaster_STATUS = 0;
         state.statemaster_UNIONTERITARY = General.Parse<int>(ddlunionteritary.SelectedValue.ToString());
         if (state.Insert(true, "statemaster"))
         {
             MessageBox("State Added Successfully");
             ScriptManager.RegisterStartupScript(this, this.GetType(), "msg2", "FillState();", true);
             FillState();
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "msg23", "AddVehicle();", true);
     }
 }
 protected void btnedit_Click(object sender, EventArgs e)
 {
     if (txteditname.Text.ToString().Trim() != string.Empty)
     {
         statemaster state = new statemaster(HttpContext.Current.Server.MapPath("~/XML/database.xml"));
         state.statemaster_STATEID = -1;
         state.statemaster_STATENAME = txteditname.Text.ToString().Trim();
         state.statemaster_STATUS = General.Parse<int>(ddlstatus.SelectedValue.ToString());
         state.statemaster_UNIONTERITARY = General.Parse<int>(ddledittype.SelectedValue.ToString());
         string condition = "STATEID=" + ViewState["stateid"].ToString();
         if (state.Insert(false, "statemaster", condition))
         {
             MessageBox("State Updated Successfully");
             ScriptManager.RegisterStartupScript(this, this.GetType(), "msg2d", "FillState();", true);
             FillState();
         }
     }
     else
     {
         ScriptManager.RegisterStartupScript(this, this.GetType(), "msg23", "EditState();", true);
     }
 }