示例#1
0
 protected void GridCountryView_StartRowEditing(object sender, DevExpress.Web.Data.ASPxStartRowEditingEventArgs e)
 {
     if (GridCountryView.IsNewRowEditing)
     {
         GridCountryView.DoRowValidation();
     }
 }
示例#2
0
        protected void GridCountryView_RowDeleting(object sender, DevExpress.Web.Data.ASPxDataDeletingEventArgs e)
        {
            string id = e.Keys[0].ToString();

            controller.DeleteCountry(id);

            e.Cancel = true;
            GridCountryView.CancelEdit();

            Bind();
        }
示例#3
0
        protected void GridCountryView_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e)
        {
            CountryViewModel model = new CountryViewModel();

            model.CountryId           = e.NewValues["CountryId"] == null ? 0 : (int)e.NewValues["CountryId"];
            model.CountryName         = e.NewValues["CountryName"].ToString() ?? string.Empty;
            model.ImageGalleryPath    = e.NewValues["ImageGalleryPath"].ToString() ?? string.Empty;
            model.ImageThumbnailsPath = e.NewValues["ImageThumbnailsPath"].ToString() ?? string.Empty;

            controller.AddCountry(model);

            e.Cancel = true;
            GridCountryView.CancelEdit();

            Bind();
        }
示例#4
0
        protected void GridCountryView_RowUpdating(object sender, DevExpress.Web.Data.ASPxDataUpdatingEventArgs e)
        {
            //   CountryViewModel model = new CountryViewModel();

            var listSaP            = (List <CountryViewModel>)GridCountryView.DataSource;
            CountryViewModel model = listSaP.Find(m => m.Id == e.Keys[0].ToString());

            model.CountryId           = e.NewValues["CountryId"] == null? 0: (int)e.NewValues["CountryId"];
            model.CountryName         = e.NewValues["CountryName"].ToString() ?? string.Empty;
            model.ImageGalleryPath    = (string)e.NewValues["ImageGalleryPath"] ?? string.Empty;
            model.ImageThumbnailsPath = (string)e.NewValues["ImageThumbnailsPath"] ?? string.Empty;

            controller.UpdateCountry(model);

            e.Cancel = true;
            GridCountryView.CancelEdit();

            Bind();
        }
示例#5
0
 protected void GridCountryView_DataBinding(object sender, EventArgs e)
 {
     // Definirati typ objekta sa kojim grid radi
     GridCountryView.ForceDataRowType(typeof(CountryViewModel));
 }
示例#6
0
 private void Bind()
 {
     GridCountryView.DataSource = controller.Init();
     GridCountryView.DataBind();
 }