Exemplo n.º 1
0
 //fungsi: menghandle ketika row pada gridview akan di edit,
 //set fokus pada isian di gridview
 protected void GvGolongan_RowEditing(object sender, GridViewEditEventArgs e)
 {
     if (Page.IsValid)
     {
         GvGolongan.EditIndex = e.NewEditIndex;
         GvGolongan.DataBind();
         this.ScriptManager1.SetFocus(GvGolongan.Rows[e.NewEditIndex].Cells[1].FindControl("txtCol1Edit").ClientID);
     }
     else
     {
         e.Cancel = true;
     }
 }
Exemplo n.º 2
0
        //fungsi: pindah halaman/index page dari gridview
        protected void txtHalaman_TextChanged(object sender, System.EventArgs e)
        {
            GridViewRow rowPager   = GvGolongan.BottomPagerRow;
            TextBox     txtHalaman = (TextBox)(rowPager.Cells[0].FindControl("txtHalaman"));

            try
            {
                if (int.Parse(txtHalaman.Text) <= GvGolongan.PageCount + 1 && int.Parse(txtHalaman.Text) > 0)
                {
                    GvGolongan.PageIndex = (int.Parse(txtHalaman.Text)) - 1;
                    GvGolongan.DataBind();
                }
            }
            catch (Exception)
            {
                txtHalaman.Text = (GvGolongan.PageIndex + 1).ToString();
            }
        }