/// <summary> /// Set Grid Data source /// </summary> /// <param name="addRow"></param> /// <param name="deleteRow"></param>e private void BindGrid() { LoanBLL objLoanBLL = new LoanBLL(); GrdPurposeofencumbrance.DataSource = objLoanBLL.GetLoan(""); GrdPurposeofencumbrance.DataBind(); }
/// <summary> /// To save details to database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SetGridSource(bool showRecentRecords) { string EncumbrancepurposeName; EncumbrancepurposeName = txtSearch.Text.Trim(); LoanBLL objLoanBLL = new LoanBLL(); LoanList objLoanList = new LoanList(); objLoanList = objLoanBLL.GetLoan(EncumbrancepurposeName); if (objLoanList.Count > 0) { GrdPurposeofencumbrance.DataSource = objLoanList; GrdPurposeofencumbrance.DataBind(); } }
/// <summary> /// Set Page header,Call BindGrid() method /// Check User Permitions /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ViewState["ENCUMBRANCEID"] = 0; Master.PageHeader = "Purpose of Encumbrance"; BindGrid(); SetGridSource(true); GrdPurposeofencumbrance.DataBind(); btnShowAdd.Attributes.Add("onclick", "SetVisible(0);"); btnShowSearch.Attributes.Add("onclick", "SetVisible(1);"); //txtPurposeofencumbrance.Attributes.Add("onchange","isDirty = 1;"); txtPurposeofencumbrance.Attributes.Add("onchange", "setDirtyText();"); if (CheckAuthorization.HasUpdatePrivilege(UtilBO.PrivilegeCode.PRIV_TENURE) == false) { btn_Save.Visible = false; btn_Clear.Visible = false; btnShowAdd.Visible = false; btnSearch.Visible = false; btnClear.Visible = false; btnShowSearch.Visible = false; GrdPurposeofencumbrance.Columns[2].Visible = false; GrdPurposeofencumbrance.Columns[3].Visible = false; GrdPurposeofencumbrance.Columns[4].Visible = false; foreach (GridViewRow grRow in GrdPurposeofencumbrance.Rows) { if (grRow.RowType == DataControlRowType.DataRow) { CheckBox chk = (CheckBox)grRow.FindControl("IsObsolete"); chk.Enabled = false; } } } } if (!Page.ClientScript.IsClientScriptBlockRegistered(this.GetType(), "MasterJS")) { Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "MasterJS", CreateStartupScript()); } }
/// <summary> /// To search details and display in grid /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSearch_Click(object sender, EventArgs e) { SetGridSource(false); GrdPurposeofencumbrance.DataBind(); }