M
mesut
Hi colleagues,
how can I configure a linqdatasource in code behind. I mean I would
like to create the linqdatasource programmatically in the code behind
rather then dropping from the toolbox.
below is the way working but I dropped the linqdatasource control on
the aspx page then configured.
<asp:LinqDataSource ID="linqDSCostCenter" runat="server"
ContextTypeName="Linq.ArtDBDataContext"
Select="new ( BusinessUnit, Type, Division,
Status, Description1, AddressID )"
TableName="FCostCenters">
</asp:LinqDataSource>
<asp:ListView ID="lvCostCenters" runat="server"
onitemdatabound="lvCostCenters_ItemDataBound"
DataSourceID="linqDSCostCenter" >
<LayoutTemplate>
I would like to do this (below) ? but get some syntax errors? so I'm
not sure what the right syntax is?
does anybody knows?
LinqDataSource objDatasource = new LinqDataSource();
Linq.ArtDBDataContext objDataContext = new
Linq.ArtDBDataContext();
objDatasource.ContextTypeName = objDataContext;
objDatasource.TableName = "CostCenters";
objDatasource.Select =
"new(BusinessUnit,Type,Division,Status,Description1,AddressID)";
lvCostCenters.DataSourceID = objDatasource;
lvCostCenters.DataBind();
thanks mesut
how can I configure a linqdatasource in code behind. I mean I would
like to create the linqdatasource programmatically in the code behind
rather then dropping from the toolbox.
below is the way working but I dropped the linqdatasource control on
the aspx page then configured.
<asp:LinqDataSource ID="linqDSCostCenter" runat="server"
ContextTypeName="Linq.ArtDBDataContext"
Select="new ( BusinessUnit, Type, Division,
Status, Description1, AddressID )"
TableName="FCostCenters">
</asp:LinqDataSource>
<asp:ListView ID="lvCostCenters" runat="server"
onitemdatabound="lvCostCenters_ItemDataBound"
DataSourceID="linqDSCostCenter" >
<LayoutTemplate>
I would like to do this (below) ? but get some syntax errors? so I'm
not sure what the right syntax is?
does anybody knows?
LinqDataSource objDatasource = new LinqDataSource();
Linq.ArtDBDataContext objDataContext = new
Linq.ArtDBDataContext();
objDatasource.ContextTypeName = objDataContext;
objDatasource.TableName = "CostCenters";
objDatasource.Select =
"new(BusinessUnit,Type,Division,Status,Description1,AddressID)";
lvCostCenters.DataSourceID = objDatasource;
lvCostCenters.DataBind();
thanks mesut