Does it have a App_Code folder? if so then my tutorial will work for you, I know it's long winded but I didn't want to miss out and step. Once you have run through it a couple of time it easy. [:D]
Dynamic DataDynamic Data FuturesAdvanced Filters
See my blog C# Bits | Twitter @sjnaughton Always seeking an elegant solution.
The ContextTypeName property of LinqDataSource 'GridDataSource' must specify a data context type.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The ContextTypeName property of LinqDataSource 'GridDataSource' must specify a data context type.
levalencia
Member
677 Points
340 Posts
ASP.NET Dynamic Data Filtering not working
Sep 05, 2008 02:45 PM|LINK
Hello. I am trying to use this DLL to make searches on dynamic data pages
http://www.codeplex.com/DynamicDataFiltering
I pasted the following code, but nothing happens
<cc1:DynamicFilterForm ID="DynamicFilterForm1" DataSourceID="GridDataSource" runat="server">
<FilterTemplate>
<table>
<tr>
<td>
Nombre activo</td>
<td>
<cc1:DynamicFilterControl ID="DynamicFilterControl3" runat="server" DataField="Name"
FilterMode="Contains" /></td>
<td>
Marca</td>
<td>
<cc1:DynamicFilterControl ID="DynamicFilterControl1" runat="server" DataField="Brand"
FilterMode="Contains" /></td>
</tr>
<tr>
<td>
Modelo</td>
<td>
<cc1:DynamicFilterControl ID="DynamicFilterControl2" runat="server" DataField="Model"
FilterMode="Contains" /></td>
<td>
Ubicacion</td>
<td>
<cc1:DynamicFilterControl ID="DynamicFilterControl4" runat="server" DataField="Location"
FilterMode="Contains" /></td>
</tr>
<tr>
<td>
Serial</td>
<td>
<cc1:DynamicFilterControl ID="DynamicFilterControl5" runat="server" DataField="Serial"
FilterMode="Contains" /></td>
<td>
Sucursal</td>
<td>
<cc1:DynamicFilterControl ID="DynamicFilterControl6" runat="server" DataField="Branch"
FilterMode="Equals" /></td>
</tr>
<tr>
<td>
Tipo de Servicio</td>
<td>
<cc1:DynamicFilterControl ID="DynamicFilterControl7" runat="server" DataField="ServiceType"
FilterMode="Equals" /></td>
<td>
Capacidad</td>
<td>
<cc1:DynamicFilterControl ID="DynamicFilterControl8" runat="server" DataField="Capacity"
FilterMode="Contains" /></td>
</tr>
<tr>
<td colspan="4">
<asp:LinkButton ID="LinkButton1" runat="server" CommandName="Search" CausesValidation="false">Search</asp:LinkButton><br />
<asp:LinkButton ID="LinkButton2" runat="server" CommandName="Clear" CausesValidation="false">Clear</asp:LinkButton><br />
<asp:LinkButton ID="LinkButton3" runat="server" CommandName="Browse" CausesValidation="false">Browse</asp:LinkButton>
</td>
</td>
</tr>
</table>
</FilterTemplate>
</cc1:DynamicFilterForm>
levalencia
Member
677 Points
340 Posts
Re: ASP.NET Dynamic Data Filtering not working
Sep 05, 2008 03:11 PM|LINK
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataSourceID="GridDataSource"
OnDataBound="OnGridViewDataBound" OnRowCreated="OnGridViewRowCreated"
OnRowDeleted="OnGridViewRowDeleted" OnRowEditing="OnGridViewRowEditing"
OnRowUpdated="OnGridViewRowUpdated"
OnSelectedIndexChanging="OnGridViewSelectedIndexChanging"
style="text-align: center; margin-right: 1px;"
onrowcommand="GridView1_RowCommand" Width="100%" EnableQueryStringSelection="True">
<PagerStyle />
<RowStyle CssClass="row" />
<Columns>
<asp:DynamicField DataField="Name" HeaderText="Nombre activo" />
<asp:DynamicField DataField="Brand" HeaderText="Marca" />
<asp:DynamicField DataField="Model" HeaderText="Modelo" />
<asp:DynamicField DataField="Location" HeaderText="Ubicacion" />
<asp:TemplateField>
<ItemTemplate>
<asp:ImageButton CommandName="Editar" CausesValidation="false" ID="EditButton" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoEdit.png" runat="server" Text="Editar" ToolTip="Editar" />
<asp:ImageButton CommandName="Delete" CausesValidation="false" ID="DeleteButton1" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoDelete.png" runat="server" Text="Eliminar" ToolTip="Eliminar" OnClientClick='return confirm("Are you sure you want to delete this item?");' />
</ItemTemplate>
<EditItemTemplate>
<asp:ImageButton CommandName="Update" CausesValidation="true" ID="EditButton" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoEdit.png" runat="server" Text="Actualizar" ToolTip="Actualizar" />
<asp:ImageButton CommandName="Cancel" CausesValidation="false" ID="DeleteButton1" ImageUrl="~/App_Themes/SodexoTheme/ImageLibrary/icoDelete.png" runat="server" Text="Cancelar" ToolTip="Cancelar" OnClientClick='return confirm("Are you sure you want to delete this item?");' />
</EditItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="tableHead" />
<PagerTemplate>
<asp:GridViewPager runat="server" />
</PagerTemplate>
<EmptyDataTemplate>
No se encuentran registros.
</EmptyDataTemplate>
<AlternatingRowStyle CssClass="alternateRow" />
</asp:GridView>
<br />
<br />
<asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true">
<%-- <WhereParameters>
<asp:DynamicControlParameter ControlID="FilterRepeater" />
</WhereParameters>--%>
</asp:LinqDataSource>
<asp:Panel ID="DetailsPanel" runat="server">
<br /><br />
<asp:LinqDataSource ID="DetailsDataSource" runat="server" EnableDelete="true" EnableInsert="true" EnableUpdate="true">
<WhereParameters>
<asp:DynamicControlParameter ControlID="GridView1" />
</WhereParameters>
</asp:LinqDataSource>
</asp:Panel>
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: ASP.NET Dynamic Data Filtering not working
Sep 05, 2008 03:35 PM|LINK
Hi Levalencia, are you trying to get it working on a file based website or a Web Application Project?
if you are trying to get it working on a file based website I have just done a tutorial on my blog here: Dynamic Data Futures – Part 1 Adding Advanced Filters
Hope this helps [:D]
Dynamic Data Dynamic Data Futures Advanced Filters
Always seeking an elegant solution.
levalencia
Member
677 Points
340 Posts
Re: ASP.NET Dynamic Data Filtering not working
Sep 05, 2008 04:04 PM|LINK
Its a website, but its on IIS not on a folder.
That tutorial seems too long, isnt there a faster way
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: ASP.NET Dynamic Data Filtering not working
Sep 05, 2008 04:39 PM|LINK
Does it have a App_Code folder? if so then my tutorial will work for you, I know it's long winded but I didn't want to miss out and step. Once you have run through it a couple of time it easy. [:D]
Dynamic Data Dynamic Data Futures Advanced Filters
Always seeking an elegant solution.
levalencia
Member
677 Points
340 Posts
Re: ASP.NET Dynamic Data Filtering not working
Sep 05, 2008 04:46 PM|LINK
No, it doesnt have the app_code folder, what may be the problem?
Thx
sjnaughton
All-Star
27308 Points
5458 Posts
MVP
Re: ASP.NET Dynamic Data Filtering not working
Sep 05, 2008 04:49 PM|LINK
So did you create it via Create Website or Create Project?
Dynamic Data
Always seeking an elegant solution.
levalencia
Member
677 Points
340 Posts
Re: ASP.NET Dynamic Data Filtering not working
Sep 05, 2008 04:56 PM|LINK
I tried the following
<cc1:DynamicLinqDataSource ID="DynamicLinqDataSource1" TableName="Assets" ContextTypeName="Sodexo.Data.ModelDataContext" runat="server">
</cc1:DynamicLinqDataSource>
<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataSourceID="DynamicLinqDataSource1"
OnDataBound="OnGridViewDataBound" OnRowCreated="OnGridViewRowCreated"
<asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true" EnableUpdate="true">
<%-- <WhereParameters>
<asp:DynamicControlParameter ControlID="FilterRepeater" />
</WhereParameters>--%>
</asp:LinqDataSource>
levalencia
Member
677 Points
340 Posts
Re: ASP.NET Dynamic Data Filtering not working
Sep 05, 2008 05:00 PM|LINK
I got this error after trying that!
The ContextTypeName property of LinqDataSource 'GridDataSource' must specify a data context type.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.InvalidOperationException: The ContextTypeName property of LinqDataSource 'GridDataSource' must specify a data context type.
Source Error:
jheyse
Member
102 Points
43 Posts
Re: ASP.NET Dynamic Data Filtering not working
Sep 05, 2008 08:46 PM|LINK
Levalencia,
You must change the type of the LinqDataSource to cc1:DynamicLinqDataSource.