i have created a grid panel for role based designation of an employee, and it was suppose to display as shown below image
Code for the grid panel is
@(Html.X().GridPanel()
.ID("GPDesignation")
.Width(1158)
.Height(260)
.Header(true)
.Store(Html.X().Store()
.PageSize(10)
.ID("SDesignation")
.Model(Html.X().Model()
.Fields(
new ModelField("ROLE_CODE", ModelFieldType.String),
new ModelField("ROLE_DESC", ModelFieldType.String),
new ModelField("DESIGNATION_CODE", ModelFieldType.String),
new ModelField("DESIGNATION_DESC", ModelFieldType.String),
new ModelField("DEFAULT_DESIG", ModelFieldType.String)
)
)
)
.ColumnModel(
Html.X().Column().Text("Role").DataIndex("ROLE_CODE").Width(150),
Html.X().Column().Text("Role Description").DataIndex("ROLE_DESC").Width(326),
Html.X().Column().Text("Designation").DataIndex("DESIGNATION_CODE").Width(250),
Html.X().Column().Text("DSG Description").DataIndex("DESIGNATION_DESC").Width(326),
Html.X().Column().Text("Default").DataIndex("DEFAULT_DESIG").Width(100)
)
.SelectionModel(Html.X().RowSelectionModel().Listeners(ls => ls.Select.Fn = "GridSelect"))
)
Data's binded to the grid using ajax jsonResult
public JsonResult Bind_Destination(string EMP_CODE)
{
List<Designation_Model> Designationlist = new List<Designation_Model>();
try
{
InitializeDB();
List<DbParams> collection = new List<DbParams>();
collection.Add(new DbParams(DbType.String, 50, "BindEmployeeDestinationgrid", "@Mode", ParameterDirection.Input));
collection.Add(new DbParams(DbType.String, 200, EMP_CODE, "@EMP_CODE", ParameterDirection.Input));
DataSet ds = ObjDbfactory.GetData("SP_Employee", false, collection);
foreach (DataRow dr in ds.Tables[0].Rows)
{
Designationlist.Add(new Designation_Model
{
ROLE_CODE = Convert.ToString(dr["ROLE_CODE"]),
ROLE_DESC = Convert.ToString(dr["ROLE_DESC"]),
DESIGNATION_CODE = Convert.ToString(dr["DESIGNATION_CODE"]),
DESIGNATION_DESC = Convert.ToString(dr["DESIGNATION_DESC"]),
DEFAULT_DESIG = Convert.ToString(dr["DEFAULTDES"])
}
);
}
}
catch (Exception ex)
{
SaveError_Log("Employee", "Setup", ex.Message);
}
return Json(Designationlist, JsonRequestBehavior.AllowGet);
}
and now the grid was displaying as shown below image without header.
kindly provide me some suggestion, and let me know what i had done wrong in it.