Sorry I could not work out where to post this as I dont understand telerik terminology well enough yet!!
I have a RadFilter and a RadGrid on my page. If I set the DataSourceControls explicitly, it works fine..
I thought the above code was the equivalent of the entitydatasource I created in the tag above? What is different?
Sorry I am a newbie so am probably missing something obvious
TIA
I have a RadFilter and a RadGrid on my page. If I set the DataSourceControls explicitly, it works fine..
<
asp:EntityDataSource
ID
=
"EntityDataSource1"
runat
=
"server"
ConnectionString
=
"name=Clarity2011Entities"
OrderBy
=
"it.[DisplayName]"
DefaultContainerName
=
"Clarity2011Entities"
EnableFlattening
=
"False"
EntitySetName
=
"tblMassMaintenanceFields"
Select
=
"it.[FieldId], it.[DisplayName], it.[FieldName], it.[TableName], it.[NetDataType]"
EntityTypeFilter
=
"tblMassMaintenanceField"
>
</
asp:EntityDataSource
>
<
div
class
=
"filterDiv"
>
<
telerik:RadFilter
runat
=
"server"
ID
=
"RadFilter1"
OnPreRender
=
"RadFilter1_PreRender"
DataSourceControlID
=
"EntityDataSource1"
FilterContainerID
=
"RadGrid1"
ShowApplyButton
=
"false"
/>
<
asp:SqlDataSource
ID
=
"dtcRadGrid1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:BRINVConnectionString %>" CancelSelectOnNullParameter="False" SelectCommand="Select DisplayName FROM tblMassMaintenanceFields">
</
asp:SqlDataSource
>
</
div
>
<
telerik:RadGrid
runat
=
"server"
ID
=
"RadGrid1"
AutoGenerateColumns
=
"False"
AllowPaging
=
"True"
AllowSorting
=
"True"
AllowFilteringByColumn
=
"True"
OnItemCommand
=
"RadGrid1_ItemCommand"
CellSpacing
=
"0"
GridLines
=
"None"
>
<
MasterTableView
IsFilterItemExpanded
=
"false"
CommandItemDisplay
=
"Top"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
></
CommandItemSettings
>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
></
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
></
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"FieldId"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter FieldId column"
HeaderText
=
"FieldId"
ReadOnly
=
"True"
SortExpression
=
"FieldId"
UniqueName
=
"FieldId"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"DisplayName"
FilterControlAltText
=
"Filter DisplayName column"
HeaderText
=
"DisplayName"
ReadOnly
=
"True"
SortExpression
=
"DisplayName"
UniqueName
=
"DisplayName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"FieldName"
FilterControlAltText
=
"Filter FieldName column"
HeaderText
=
"FieldName"
ReadOnly
=
"True"
SortExpression
=
"FieldName"
UniqueName
=
"FieldName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"TableName"
FilterControlAltText
=
"Filter TableName column"
HeaderText
=
"TableName"
ReadOnly
=
"True"
SortExpression
=
"TableName"
UniqueName
=
"TableName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"NetDataType"
FilterControlAltText
=
"Filter NetDataType column"
HeaderText
=
"NetDataType"
ReadOnly
=
"True"
SortExpression
=
"NetDataType"
UniqueName
=
"NetDataType"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
></
EditColumn
>
</
EditFormSettings
>
<
CommandItemTemplate
>
<
telerik:RadToolBar
runat
=
"server"
ID
=
"RadToolBar1"
OnButtonClick
=
"RadToolBar1_ButtonClick"
>
<
Items
>
<
telerik:RadToolBarButton
Text
=
"Apply filter"
CommandName
=
"FilterRadGrid"
ImageUrl="<%#GetFilterIcon() %>"
ImagePosition="Right" />
</
Items
>
</
telerik:RadToolBar
>
</
CommandItemTemplate
>
</
MasterTableView
>
<
FilterMenu
EnableImageSprites
=
"False"
></
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Default"
></
HeaderContextMenu
>
</
telerik:RadGrid
>
But when I write code to create the entitydatasource I get object not set to instance of an object when the page displays..
Here is the code:
EntityDataSource ClarityEntities = new EntityDataSource();
var conEntitiesString = ConfigurationManager.ConnectionStrings["Clarity2011Entities"];
string strConnEntitiesString = conEntitiesString.ConnectionString;
ClarityEntities.ConnectionString = strConnEntitiesString;
ClarityEntities.OrderBy = "it.[DisplayName]";
ClarityEntities.EnableFlattening = false;
ClarityEntities.DefaultContainerName = "Clarity2011Entities";
//ClarityEntities.ContextTypeName =
ClarityEntities.EntitySetName = "tblMassMaintenanceFields";
ClarityEntities.Select = "it.[FieldId], it.[DisplayName], it.[FieldName], it.[TableName], it.[NetDataType]";
ClarityEntities.EntityTypeFilter = "tblMassMaintenanceField";
RadGrid1.DataSource = ClarityEntities;
RadGrid1.MasterTableView.DataSource = ClarityEntities;
Sorry I am a newbie so am probably missing something obvious
TIA