Note that there are some explanatory texts on larger screens.

plurals
  1. POBinding Gridview by Eval in Linq
    text
    copied!<p>I have a LINQ expression that joins two tables. I want to Bind 'List' to Gridview. the code makes this error in Gridview Template: <strong>DataBinding: 'SearchResult' does not contain a property with the name 'codereq'.</strong></p> <pre><code>IQueryable&lt;SearchResult&gt; myList = from t in TBL_Apartment join k in TBL_Owner on t.Code equals k.Code where k.CodeReq == t.CodeReq select new SearchResult { codereq= t.CodeReq, name = t.Name } public class SearchResult { public string codereq; public string name; } </code></pre> <p>Bind Gridview Code:</p> <pre><code> GridSearch.DataSource = myList.ToList(); GridSearch.DataBind(); </code></pre> <p>as my aspx page for grid view is as below :</p> <pre><code>&lt;telerik:RadGrid ID="GridSearch" runat="server" Skin="Office2007" AutoGenerateColumns="False" dir="rtl" Width="750px" GridLines="None" &gt; &lt;MasterTableView&gt; &lt;Columns&gt; &lt;telerik:GridTemplateColumn HeaderText="Request Code" FilterControlWidth="100px"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="Label1" runat="server" Text='&lt;%# Eval("codereq")==""?"0":Eval("codereq") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/telerik:GridTemplateColumn&gt; &lt;telerik:GridTemplateColumn HeaderText="Owner Name" FilterControlWidth="100px"&gt; &lt;ItemTemplate&gt; &lt;asp:Label ID="Lbl_Mahale" runat="server" Text='&lt;%# Eval("name")==""?"":Eval("name") %&gt;'&gt;&lt;/asp:Label&gt; &lt;/ItemTemplate&gt; &lt;/telerik:GridTemplateColumn&gt; &lt;/Columns&gt; &lt;/MasterTableView&gt; &lt;PagerStyle AlwaysVisible="True" /&gt; &lt;ClientSettings&gt;&lt;Selecting AllowRowSelect="True" /&gt;&lt;/ClientSettings&gt; &lt;/telerik:RadGrid&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload