protected void BindACContacts() { try { gvAmeriCorps.DataSource = Americorpsmembers.GetAmericorps(); gvAmeriCorps.DataBind(); } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }
protected void btnSubmit_Click(object sender, EventArgs e) { try { Americorpsmembers.AddACContact(txtFName.Text, txtLName.Text, Convert.ToInt32(ddlApplicantName.SelectedValue.ToString() != "0" ? ddlApplicantName.SelectedValue.ToString() : "0")); lblErrorMsg.Text = "AC Contact added successfully"; txtFName.Text = ""; txtLName.Text = ""; gvAmeriCorps.PageIndex = 0; GetApplicant(); BindACContacts(); } catch (Exception ex) { lblErrorMsg.Text = ex.Message; } }
protected void gvAmeriCorps_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { int rowIndex = e.RowIndex; int contId = Convert.ToInt32(((Label)gvAmeriCorps.Rows[rowIndex].FindControl("lblcontId")).Text); string fName = ((TextBox)gvAmeriCorps.Rows[rowIndex].FindControl("txtFName")).Text; string LName = ((TextBox)gvAmeriCorps.Rows[rowIndex].FindControl("txtLName")).Text; Americorpsmembers.UpdateACContact(fName, LName, contId); gvAmeriCorps.EditIndex = -1; BindACContacts(); lblErrorMsg.Text = "AC Contact updated successfully"; txtFName.Text = ""; txtLName.Text = ""; } catch (Exception) { lblErrorMsg.Text = "Error updating the AC contact"; lblErrorMsg.Visible = true; } }
protected void BindGridWithSort() { DataTable dt = Americorpsmembers.GetAmericorps(); SortDireaction = CommonHelper.GridSorting(gvAmeriCorps, dt, SortExpression, SortDireaction != "" ? ViewState["SortDireaction"].ToString() : SortDireaction); }