ananth ganapathy

ananth ganapathy

  • 1.6k
  • 84
  • 24.6k

Display Records in WebGrid from Two Tables Details

Aug 6 2014 7:34 AM

hi friends

these are my model classes:

public partial class tbl_staticfielddetails
{
public Nullable<int> institutionid { get; set; }
public string fieldname { get; set; }
public string required { get; set; }
public string predefinedvalue { get; set; }
public string fieldpattern { get; set; }
public string errormsg { get; set; }
public string minimum { get; set; }
public string maximum { get; set; }
public int fieldorder { get; set; }
public string tooltype { get; set; }
public string datatype { get; set; }
public string disptype { get; set; }
public int id { get; set; }
public string status { get; set; }
public string label { get; set; }
public string instructuser { get; set; }
}

public partial class tbl_student
{
public int Stud_id { get; set; }
public int institutionid { get; set; }
public string firstname { get; set; }
public string middlename { get; set; }
public string lastname { get; set; }
public string studentimage { get; set; }
public Nullable<long> admissionnumber { get; set; }
public string admissionforclass { get; set; }
public Nullable<System.DateTime> dateofadmission { get; set; }
public Nullable<long> boardregisternumber { get; set; }
public Nullable<System.DateTime> dateofbirth { get; set; }
public string gender { get; set; }
public string isactive { get; set; }

}

below are two tables corresponding to models.

please refer the image

i want to display table 2 records in webgrid

but its column header is refered from table 1's label field.

my requirement is how to design the model class as well as controller method to display records in webgrid .

thanks in advance.