c# - Gridview is not binding properly: -


I am using

I have a LINQ query which I set and I am bound to a GridView using the following query Am But Gridview is not properly binding. In all the rows, it looks like this:

System.ink.memricular + Where to selectIntequireElectrector 2 [[lt; & Gt; F__AnonymousType652 6 [system. Minus] 1 [System .32], System.String, System.String, System.String, System.String, System.Int32], System.String]

My aspx page < / p>

  & lt; Columns & gt; & Lt; ASP: TemplateField HeaderText = "Slow No." ItemStyle-HorizontalAlign = "center" & gt; & Lt; ItemTemplate & gt; & Lt; Div style = "margin: 0 pixels auto, width: auto;" & Gt; & Lt; asp: label id = "lblslno" runat = "server" text = '& lt;% # container.displayindex + 1% & gt;' & Gt; '& Gt; & Lt; / Asp: label & gt; & Lt; asp: HiddenField id = "hf" runat = "server" value = '& lt;% # Eval ("EmpId")%> / & Gt; & Lt; / Div & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; ASP: Boundfield header text = "employee code." Datafield = "Empcode" item-style-horizontal alliance = "center" /> & Lt; ASP: Boundfield header text = "employee's name" datafield = "name" /> & Lt; Asp: boundfield header text = "section" datafile = "department name" /> & Lt; ASP: Boundfield headtext = "Designation" datafield = "Designam" /> & Lt; asp: TemplateField HeaderText = "Total Points" Item Style-Horizontal Alliance = "Center" & gt; & Lt; ItemTemplate & gt; & Lt; Asp: Label ID = "lblTotalMarks" runat = "server" CssClass = "label" text = '& lt;% # Eval ("Total_Mark")% & gt; & Gt; & Lt; / Asp: Label & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; ASP: TemplateField HeaderText = "Mark Secure" Item Style- Horizontal Alliance = "Center" & gt; & Lt; ItemTemplate & gt; & Lt; Asp: Label ID = "lbl MarxSheier" runat = "server" CssClass = "Label" Text = '& lt;% # Eval ("Total_Mark")% & gt; & Gt; & Lt; / Asp: Label & gt; & Lt; / ItemTemplate & gt; & Lt; / ASP: TemplateField & gt; & Lt; / Column & gt;   

And the code behind me is like this

  var query = (Tranning from one to one in transferencing in Transning AshesSheet in Transverting the Devices in Transverting Anniversary Description in AppProphonal Description from E in EmpProfessionalJobD, from the Department in G in the Department from where the training is scheduled.Did == int. Purse (ddlExamDate.SelectedValue) & A. Training scheduleDetailId == B. Training scheduleDetailId & amp; ; Amp; B. Training AnswersSh eetId == c. Training AnswersSheetId & amp; & Amp; amp; amp; amp; amp; amp; amp; amp; staff · Professional DetailId · · · · · · · · · · · · · · · · · · · · · · · · · · · · business trade · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · · .EmployeeProfessionalDetailId, name = d.FirstName + "" + d.MiddleName + "" + d.ListName, d .EmployeeCode, f.DepartmentName, g.DesignationName, Total_Mark = total_Mark,}). ToList (); Var query2 = (new selection b by a.EmployeeProfessionalDetailId a query group {EmpId = b.Key, name = b.Select (c = & gt; c.Name), EmpCode = b.Select (c = & gt ; C.EmployeeCode), DeptName = b.Select (c => c.DepartmentName), DesigName = b.Select (c => c.DesignationName), Total_Mark = b.Select (c => C .}). (to create a list); grdEmployeeDetails.DataSource = query2; grdEmployeeDetails.DataBind ();    

Define a new class for grid binding example, create 'Employee Results' with the required properties and a list of objects related to the grid.

  List & l T; EmployeeResults> EmployeeResults = Link query. // Give links to artists results grdEmployeeDetails.DataSource = employeeResults; grdEmployeeDetails.DataBind ();    

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -