Пример #1
0
        protected void RadGrid1_InsertCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            GridEditableItem editedItem  = e.Item as GridEditableItem;
            UserControl      userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
            Kas kas = new Kas();

            kas.KaCode    = (userControl.FindControl("txtKasCode") as RadTextBox).Text.Trim().ToUpper();
            kas.KaName    = (userControl.FindControl("txtKaName") as RadTextBox).Text.Trim().ToUpper();
            kas.SaldoAwal = Convert.ToDecimal((userControl.FindControl("txtSaldo") as RadTextBox).Text.Trim());
            kas.PeriodeId = Convert.ToInt32(HttpContext.Current.Session["_periodeId"]);
            kas.Save();
        }
Пример #2
0
        protected void RadGrid1_UpdateCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
        {
            Int32            KasId       = 0;
            GridEditableItem editedItem  = e.Item as GridEditableItem;
            UserControl      userControl = (UserControl)e.Item.FindControl(GridEditFormItem.EditFormUserControlID);
            Kas kas = new Kas();

            KasId = Convert.ToInt32((userControl.FindControl("txtBkuId") as RadTextBox).Text.Trim());
            if (kas.LoadByPrimaryKey(KasId))
            {
                kas.KaName    = (userControl.FindControl("txtKaName") as RadTextBox).Text.Trim().ToUpper();
                kas.SaldoAwal = Convert.ToDecimal((userControl.FindControl("txtSaldo") as RadTextBox).Text.Trim());
                kas.Save();
            }
        }