Hello,
I'm learning LINQ and have run into a problem. I created a simple query against the northwind db, and I'm shaping the fields that should be returned. The problem is After run , I can't modify any of the fields in my AspxGridView .
<dxwgv:ASPxGridView ID="ASPxGridView1" runat="server"
AutoGenerateColumns="False" KeyFieldName="CategoryID">
<Columns>
<dxwgv:GridViewCommandColumn VisibleIndex="0">
<EditButton Visible="True">
</EditButton>
<NewButton Visible="True">
</NewButton>
<DeleteButton Visible="True">
</DeleteButton>
</dxwgv:GridViewCommandColumn>
<dxwgv:GridViewDataTextColumn Caption="CategoryID" FieldName="CategoryID"
VisibleIndex="1">
</dxwgv:GridViewDataTextColumn>
<dxwgv:GridViewDataTextColumn Caption="CategoryName" FieldName="CategoryName"
VisibleIndex="2">
</dxwgv:GridViewDataTextColumn>
<dxwgv:GridViewDataTextColumn Caption="Description" FieldName="Description"
VisibleIndex="3">
</dxwgv:GridViewDataTextColumn>
</Columns>
</dxwgv:ASPxGridView>
C# syntax:
protected void Page_Load(object sender, EventArgs e)
{
NorthwindDataContext db = new NorthwindDataContext();
var r = db.Categories
.Select(p=>new {p.CategoryID,p.CategoryName,p.Description});
ASPxGridView1.DataSource = r;
ASPxGridView1.DataBind();
}
You guys may say it's problem for var anonymous type .But i always need to use anonymous type.How to solve this problem