//fungsi: menghandle ketika row pada gridview akan di edit, //set fokus pada isian di gridview protected void GvPosition_RowEditing(object sender, GridViewEditEventArgs e) { if (Page.IsValid) { GvPosition.EditIndex = e.NewEditIndex; GvPosition.DataBind(); this.ScriptManager1.SetFocus(GvPosition.Rows[e.NewEditIndex].Cells[1].FindControl("txtCol1Edit").ClientID); } else { e.Cancel = true; } }
//fungsi: pindah halaman/index page dari gridview protected void txtHalaman_TextChanged(object sender, System.EventArgs e) { GridViewRow rowPager = GvPosition.BottomPagerRow; TextBox txtHalaman = (TextBox)(rowPager.Cells[0].FindControl("txtHalaman")); try { if (int.Parse(txtHalaman.Text) <= GvPosition.PageCount + 1 && int.Parse(txtHalaman.Text) > 0) { GvPosition.PageIndex = (int.Parse(txtHalaman.Text)) - 1; GvPosition.DataBind(); } } catch (Exception) { txtHalaman.Text = (GvPosition.PageIndex + 1).ToString(); } }