public void EmptyFormFields() { TxtPersonName.Text = string.Empty; TxtDesignation.Text = string.Empty; TxtContactNo1.Text = string.Empty; TxtContactNo2.Text = string.Empty; TxtEMailId1.Text = string.Empty; TxtEmailId2.Text = string.Empty; TxtNote.Text = string.Empty; TxtPersonName.Focus(); ImgAddGrid.ImageUrl = "~/Images/Icon/Gridadd.png"; ViewState["GridIndex"] = null; }
protected void GridDetails_RowCommand(object sender, GridViewCommandEventArgs e) { try { int Index; if (e.CommandName == "SelectGrid") { if ((!(string.IsNullOrEmpty(GridDetails.Rows[0].Cells[2].Text))) && GridDetails.Rows[0].Cells[2].Text.Equals(" ")) { obj_Comman.ShowPopUpMsg("There Is No Record To Edit", this.Page); TxtPersonName.Focus(); } else { ImgAddGrid.ImageUrl = "~/Images/Icon/GridUpdate.png"; ImgAddGrid.ToolTip = "Update"; //TXTUPDATEVALUE.Text = "0"; Index = Convert.ToInt32(e.CommandArgument); ViewState["GridIndex"] = Index; TxtPersonName.Text = GridDetails.Rows[Index].Cells[2].Text; TxtContactNo1.Text = GridDetails.Rows[Index].Cells[4].Text; TxtEMailId1.Text = GridDetails.Rows[Index].Cells[6].Text; if (!GridDetails.Rows[Index].Cells[3].Text.Equals(" ")) { TxtDesignation.Text = GridDetails.Rows[Index].Cells[3].Text; } else { TxtDesignation.Text = ""; } if (!GridDetails.Rows[Index].Cells[5].Text.Equals(" ")) { TxtContactNo2.Text = GridDetails.Rows[Index].Cells[5].Text; } else { TxtContactNo2.Text = ""; } if (!GridDetails.Rows[Index].Cells[7].Text.Equals(" ")) { TxtEmailId2.Text = GridDetails.Rows[Index].Cells[7].Text; } else { TxtEmailId2.Text = ""; } if (!GridDetails.Rows[Index].Cells[8].Text.Equals(" ")) { TxtNote.Text = GridDetails.Rows[Index].Cells[8].Text; } else { TxtNote.Text = ""; } } TxtPersonName.Focus(); } //ImgAddGrid.ImageUrl = "~/Images/Icon/Gridadd.png"; } catch (Exception ex) { throw new Exception(ex.Message); } }