예제 #1
0
        protected void LoadState()
        {
            BusinessLayer.State ObjState = new BusinessLayer.State();
            DataTable           dt       = ObjState.GetAll();

            ViewState["State"] = dt;
        }
예제 #2
0
 protected void dgvState_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     StateId = Convert.ToInt32(dgvState.DataKeys[e.RowIndex].Value.ToString());
     BusinessLayer.State ObjState = new BusinessLayer.State();
     ObjState.Delete(StateId);
     LoadStateList();
 }
예제 #3
0
 protected void dgvState_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName.Equals("AddUpdate"))
     {
         int RowIndex = Convert.ToInt32(e.CommandArgument.ToString());
         StateId = Convert.ToInt32(dgvState.DataKeys[RowIndex].Value.ToString());
         BusinessLayer.State ObjState = new BusinessLayer.State();
         Entity.State        State    = new Entity.State();
         State.StateId   = StateId;
         State.StateName = ((TextBox)dgvState.Rows[RowIndex].FindControl("txtState")).Text;
         ObjState.Save(State);
         LoadStateList();
     }
 }
예제 #4
0
        protected void LoadStateList()
        {
            BusinessLayer.State ObjState = new BusinessLayer.State();
            DataTable           dt       = ObjState.GetAll();
            DataRow             dr       = dt.NewRow();

            dr["StateId"]   = "0";
            dr["StateName"] = "";
            dt.Rows.InsertAt(dr, 0);
            dt.AcceptChanges();

            dgvState.DataSource = dt;
            dgvState.DataBind();
        }