代码之家  ›  专栏  ›  技术社区  ›  Perpetualcoder

是否更改为在动态数据中生成gridview而生成的Select语句?

  •  1
  • Perpetualcoder  · 技术社区  · 17 年前

    表1:EducationLevel(id、levelname、modby、modon)

    表2:课程(id、课程名称、modby、modon、belongstoeduelevel)

    其中belongstoedlevel是FK。在这种情况下,动态数据从不在网格中显示levelname,而是显示

    运营|模式|教育计划

    3 回复  |  直到 17 年前
        1
  •  2
  •   Wizzard    17 年前

    如果是这样,您需要做的就是将DisplayColumn应用于FK引用的表,并将PK选择为要显示的列。

    即 [显示列(“Id”)]

    Id是要在FK关系和筛选器中显示的列的名称。

        2
  •  1
  •   RSolberg    17 年前

    [ScaffoldTable(true)]
    [MetadataType(typeof(CourseMetaData))]
    public partial class Course
    {
    
    }
    [DisplayName("Courses")]
    public class CourseMetaData
    {
        [DisplayName("Course ID")]
        public object CourseID { get; set; }
    
        [DisplayName("Course Name")]
        public object CourseName { get; set; }
    
        [DisplayName("Modified By")]
        public object ModifiedBy { get; set; }
    
        [DisplayName("Modified By")]
        public object ModifiedBy { get; set; }
    
        [DisplayName("Modified On")]
        [DisplayFormat(DataFormatString = "{0:MM-dd-yyyy}")]
        public object ModifiedOn { get; set; }
    
        [DisplayName("Level Name")]
        public object EducationLevelName { get; set; }
    
    }
    

    如果你没有关于教育水平的标准,就拿这个:

    [ScaffoldTable(true)]
    [DisplayColumn("EducationLevelName")]
    [MetadataType(typeof(EducationLevelMetadata))]
    public partial class EducationLevel : INotifyPropertyChanging, INotifyPropertyChanged
    {
    
    }
    
    [DisplayName("Education Levels")]
    public class EducationLevelMetadata
    {
        [DisplayName("Education Level ID")]
        public object EducationLevelID { get; set; }
    
        [DisplayName("Education Level Name")]
        public object EducationLevelName { get; set; }
    
        [DisplayName("Education Level Modified By")]
        public object EducationLevelModBy { get; set; }
    
        [DisplayName("Education Level Modified On")]
        [DisplayFormat(DataFormatString = "{0:MM-dd-yyyy}")]
        public object EducationLevelModOn { get; set; }
    }
    
        3
  •  0
  •   Wizzard    17 年前

    [MetadataType(typeof(Message_MD))]
    public partial class Message
    {
        public override String ToString()
        {
            return MessageID.ToString() + ", " + Subject;
        }
        public partial class Message_MD
        {
            public object MessageID { get; set; }
            public object Subject { get; set; }
            public object Body { get; set; }
            public object SMSBody { get; set; }
        }
    }
    

    这里我有PK Id和一些显示的文本

    i、 e.12,测试信息

    推荐文章