This is a migrated thread and some comments may be shown as answers.

[Solved] Grid Editing problem Telerik q1 2011 beta

2 Answers 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
adeel zahid
Top achievements
Rank 1
adeel zahid asked on 11 Mar 2011, 06:33 AM
Hello everyone,
i have just upgraded from telerik q3 2010 to q1 2011 beta. in grid editing i have checkbox that enables/disables two fields (one text and one dropdown list) using jquery. when i used this setting with q3 2010 release, it does not post any value for disabled field but in q1 2011 it posts null value for disabled field that makes my modelstate false in the controller. my model looks something like
public class VMDoctorHospital
    {
        [HiddenInput(DisplayValue = false)]
        public int DrHospitalID { get; set; }
        [HiddenInput(DisplayValue = false)]
        public int DoctorID { get; set; }
        [DisplayName("Personal Clinic?")]
        public bool PersonalClinic { get; set; }
        [DisplayName("Clinic Name")]
        public string ClinicName { get; set; }
        [DisplayName("Hospital"), UIHint("IntStrEditor")]
        public int? HospitalID { get; set; }
        [DisplayName("Doctor's Position")]
        public string DoctorPosition { get; set; }
        [DataType(DataType.PhoneNumber), DisplayName("Phone Number"), RegularExpression(@"(0|00)\d{9,12}", ErrorMessage = "0518782645 or 0092518782645")]
        public string PhoneNumber { get; set; }
        [DisplayName("Morning From")]
        public string MorningFromTiming { get; set; }
        [DisplayName("Morning To")]
        public string MorningToTiming { get; set; }
        [DisplayName("Evening From")]
        public string EveningFromTiming { get; set; }
        [DisplayName("Evening To")]
        public string EveningTotiming { get; set; }
        [DisplayName("Morning Patients"),RegularExpression(@"\d*",ErrorMessage = "Numbers only")]
        public int? MorningOPD { get; set; }
        [DisplayName("Evening Patients"), RegularExpression(@"\d*", ErrorMessage = "Numbers only")]
        public int? EveningOPD { get; set; }
        public string BTV { get; set; }
        [UIHint("BestDay")]
        public string BDV { get; set; }
        [UIHint("BuyingMotive"),DisplayName("Buying Motive")]
        public string BuyingMotive { get; set; }
        [HiddenInput(DisplayValue = false)]
        public string HospitalClinicName { get; set; }
        [DataType(DataType.MultilineText)]
        public string Chemist { get; set; }
 
    }
Strange thing is that error appears for the key HospitalID when it is nullable and does not have any required check on it. why it is an error? plz look at two screen shots to see the input scenarios

2 Answers, 1 is accepted

Sort by
0
Atanas Korchev
Telerik team
answered on 11 Mar 2011, 12:57 PM
Hello adeel zahid,

Since the Q1 2011 beta the grid will send the whole data item object back to the server. Before it used to send only the editable fields. We decided to change this behavior to make it easier for the developer. Before that the object which was passed to the update action method was not fully initialized - the read only fields were missing. Then the developer had to merge the new values with the existing ones manually.

Regards,
Atanas Korchev
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
adeel zahid
Top achievements
Rank 1
answered on 11 Mar 2011, 01:10 PM
Hello,
thanks for reply. can you put some light on why null value is generating error for HospitalID property when it is nullable and not decorated with required attribute
Tags
Grid
Asked by
adeel zahid
Top achievements
Rank 1
Answers by
Atanas Korchev
Telerik team
adeel zahid
Top achievements
Rank 1
Share this question
or