Category Archives: QueryExtender

QueryExtender

[RESOLVED]query extender control

Below is my coding on the query extender control… all working fine but if i want to show a prompt up message said if no record found?

what should i do ? how to do it ?

Coding(HolidaySearch.aspx)

<%@ Page Title="" Language="C#" MasterPageFile="~/SiteAdmin.Master" AutoEventWireup="true" CodeBehind="HolidaySearch.aspx.cs" Inherits="TimeAttendReport.Account.HolidaySearch" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .style3
        {
            width: 766px;
        }
        .style4
        {
            width: 100%;
        }
        .style5
        {
            width: 200px;
        }
        </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <h2 style="color: Blue">
            Holiday Search:</h2>
    </div>
    <table class="style4">
        <tr>
            <td class="style5">
                Holiday Search:</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style5">
                &nbsp;</td>
            <td>
                &nbsp;</td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style5">
                Holiday Name:</td>
            <td>
                <asp:TextBox ID="txtHoliday" runat="server" Height="22px" Width="221px"></asp:TextBox>
            </td>
            <td>
                &nbsp;</td>
        </tr>
        <tr>
            <td class="style5">
                &nbsp;</td>
            <td>
                <asp:Button ID="Button2" runat="server" Text="Search" />
            </td>
            <td>
                &nbsp;</td>
        </tr>
    </table>
      <div>
      <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
            AutoGenerateColumns="False" CellPadding="4" DataSourceID="LinqDataSource1"
            ForeColor="#333333" GridLines="None" PageSize="8" Width="531px"
              style="text-align: center; background-color: #0000FF;">
            <AlternatingRowStyle BackColor="White" />
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="ID" HeaderText="ID" SortExpression="ID"
                    InsertVisible="False" />
                <asp:BoundField DataField="Holiday1" HeaderText="Holiday1"
                    SortExpression="Holiday1" />
                <asp:BoundField DataField="Date" HeaderText="Date" SortExpression="Date" />
                <asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
            </Columns>
            <EditRowStyle BackColor="#2461BF" />
            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
            <RowStyle BackColor="#EFF3FB" />
            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
            <SortedAscendingCellStyle BackColor="#F5F7FB" />
            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
            <SortedDescendingCellStyle BackColor="#E9EBEF" />
            <SortedDescendingHeaderStyle BackColor="#4870BE" />
        </asp:GridView>
            <asp:LinqDataSource ID="LinqDataSource1" runat="server"
              ContextTypeName="TimeAttendReport.App_Code.DataClasses1DataContext"
              EnableDelete="True" EnableInsert="True" EnableUpdate="True" EntityTypeName=""
              TableName="Holidays">
          </asp:LinqDataSource>
          <asp:QueryExtender ID="QueryExtender1" runat="server" TargetControlID="LinqDataSource1">
          <asp:SearchExpression DataFields="Holiday1" SearchType ="StartsWith">
          <asp:ControlParameter ControlID = "txtHoliday" />
          </asp:SearchExpression>
          </asp:QueryExtender>
            </div>
</asp:Content>

In Server side (C#) during gridview databind you can check if datatsource is empty means no records you can show message or

Use the GridView Empty Data Template.  See the example here:

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.emptydatatemplate%28VS.80%29.aspx

the GridView dislay its EmptyTemplate content if there is no data , you can configure the gridView to Display that message by setting theEmptyDataTemplate of the
gridview as foolwos :

<asp:GridView ID="GridView1" runat="server">
        <EmptyDataTemplate>
            No Data Exists
        </EmptyDataTemplate>
        <Columns >
        ......
        </Columns>
    </asp:GridView>


VS2010 : QueryExtender generating too many querys

Hi,

I created a simple scenario :

  • One dropdownlist with countries (from linqdatasource)
  • One gridview with customers (from linqdatasource)
  • One queryextender filtering the gridview(linqdatasource) based on the dropdownlist.

The result is very, very strange : While the first linqdatasource is filling the dropdownlist, for each country added in the dropdownlist the queryextender generate a query filtering customers by this country. As a result, the database receive a lot of queries,
much more than I would like to (I saw the queries in sql profiler)

The question : Did I do something wrong or should I register this in connect ?

The code :

<asp:LinqDataSource ID="LinqDataSource2" runat="server"
            ContextTypeName="site1.NorthDataContext" EntityTypeName="" GroupBy="Country"
            Select="new (key as Country, it as Customers)" TableName="Customers">
        </asp:LinqDataSource>
        <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
            DataSourceID="LinqDataSource2" DataTextField="Country" DataValueField="Country">
        </asp:DropDownList>
        <br />
        <asp:LinqDataSource ID="LinqDataSource1" runat="server"
            ContextTypeName="site1.NorthDataContext" EnableDelete="True"
            EnableInsert="True" EnableUpdate="True" EntityTypeName="" TableName="Customers">
        </asp:LinqDataSource>
    <asp:QueryExtender runat="server" TargetControlID="LinqDataSource1">
        <asp:PropertyExpression>
            <asp:ControlParameter ControlID="DropDownList1" Name="Country" />
        </asp:PropertyExpression>
    </asp:QueryExtender>
    </div>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True"
        AllowSorting="True" AutoGenerateColumns="False"
        BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px"
        CellPadding="2" DataKeyNames="CustomerID" DataSourceID="LinqDataSource1"
        EnablePersistedSelection="True" ForeColor="Black" GridLines="None">
        <AlternatingRowStyle BackColor="PaleGoldenrod" />
        <Columns>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
                ShowSelectButton="True" />
            <asp:BoundField DataField="CustomerID" HeaderText="CustomerID" ReadOnly="True"
                SortExpression="CustomerID" />
            <asp:HyperLinkField DataNavigateUrlFields="CustomerID"
                DataNavigateUrlFormatString="clientes/{0}" DataTextField="CompanyName"
                HeaderText="CompanyName" SortExpression="CompanyName" />
            <asp:BoundField DataField="ContactName" HeaderText="ContactName"
                SortExpression="ContactName" />
            <asp:BoundField DataField="Country" HeaderText="Country"
                SortExpression="Country" />
        </Columns>
        <FooterStyle BackColor="Tan" />
        <HeaderStyle BackColor="Tan" Font-Bold="True" />
        <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"
            HorizontalAlign="Center" />
        <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
    </asp:GridView>

Thanks !

 

Dennes

 

[RESOLVED]Conditional Cell Formating of GridView not happening in asp.net

I have been stuck with an issue that seems really simple, but I have no clue what is going wrong. I am a newbie with Asp and am therefore not aware of the debugging fundamentals.

I am trying to change the color of a cell text based on its value in the Result Column. I have attached the code for your reference. Kindly tell me whats wrong, nothign is getting reflected.

Columns> <asp:BoundField DataField="TestCaseID" HeaderText="TestCaseID" SortExpression="TestCaseID" /> 
<asp:BoundField DataField="Iteration" HeaderText="Iteration" SortExpression="Iteration" />
 <asp:BoundField DataField="StartTime" HeaderText="StartTime" SortExpression="StartTime" />
<asp:BoundField DataField="EndTime" HeaderText="EndTime" SortExpression="EndTime" /> 
<asp:BoundField DataField="Result" HeaderText="Result" SortExpression="Result" />
<asp:BoundField DataField="Comments" HeaderText="Comments" SortExpression="Comments" />
</Columns>
 <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
 <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
 <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
 <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<SortedAscendingCellStyle BackColor="#FDF5AC" /> <SortedAscendingHeaderStyle BackColor="#4D0000" />
<SortedDescendingCellStyle BackColor="#FCF6C0" /> <SortedDescendingHeaderStyle BackColor="#820000" />
</asp:GridView>
<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=Test_Manager_DatabaseEntities"
 DefaultContainerName="Test_Manager_DatabaseEntities" EnableFlattening="False" EntitySetName="TestExecutionDetails"
Where="it.[TestExecutionID] = @ExecutionID ">
<WhereParameters> <asp:QueryStringParameter Name="ExecutionID" QueryStringField="ExecutionID" Type="Int32" />
 </WhereParameters> </asp:EntityDataSource>
<asp:QueryExtender ID="ctlMyQueryExtender" runat="server" TargetControlID="EntityDataSource1">
 <asp:SearchExpression DataFields="Result" SearchType="StartsWith"> <asp:ControlParameter ControlID="TextBoxName" />
</asp:SearchExpression>
 </asp:QueryExtender>
</ContentTemplate>
</asp:UpdatePanel>

using System;
 using System.Collections.Generic;
using System.Linq; using System.Web;
 using System.Web.UI;
using System.Web.UI.WebControls;

 namespace ABCD
 {

public partial class TestExecutionResults : System.Web.UI.Page

 {

private int TestExecID;
protected void Page_Load(object sender, EventArgs e)

{

//Response.Cache.SetCacheability(HttpCacheability.NoCache);

//Response.CacheControl = "no-cache";

if (!Page.IsPostBack)

 using (Test_Manager_DatabaseEntities entities = new Test_Manager_DatabaseEntities())
{
Console.WriteLine(Request.QueryString["ExecutionID"]);
 TestExecID = Convert.ToInt32(Request.QueryString["ExecutionID"]);
}

}

 protected void Timer2_Tick(object sender, EventArgs e)
{
GridView1.DataBind();

 }

 protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{

if (e.Row.RowType == DataControlRowType.DataRow)
{

if (e.Row.Cells[4].Text == "Pass")
{
e.Row.Cells[4].ForeColor = System.Drawing.Color.Green;
 }

else if (e.Row.Cells[4].Text == "Fail")

{ e.Row.Cells[4].ForeColor = System.Drawing.Color.Red;
 }
}
}
}
}

I assume you’ve hooked up the RowDataBound event properly since I can’t see your gridview line.

Otherwise put a breakpoint in the rowdatabound event and step through your code. The Cell index might be wrong or the cell content might not be macthing Pass/Fail.

Thank you MetalAsp.Net, I tried putting a breakpoint, it looks like the if condition is failing

if (e.Row.RowType == DataControlRowType.DataRow), because it does not continue into this conditional, instead it goes back to calling the function. Has it got something to do with the Timer.

Please help.

Thanks

Your code looks good, try this

if (e.Row.Cells[4].Text.Trim().ToLower() == "pass")
{
   e.Row.Cells[4].ForeColor = System.Drawing.Color.Green;
}
else
{
   e.Row.Cells[4].ForeColor = System.Drawing.Color.Red;
}

Thanks a lot oned_gk. You solved it. :)

ASP.NET 4, ASP.NET MVC 2 and Visual Studio 2010

ASP.NET 4 and Visual Studio 2010 are released!

  • ASP.NET 4 Web Forms to give you more control over your HTML such as handling client IDs, managing view-state closely and the ability to generate more semantically correct markup. You can also enable dynamic data in your existing applications and
    further leverage the extensibility enhancements such as QueryExtender, filtering and templates.  URL routing is a great feature to help you to create search-engine (SEO) friendly URLs.
  • There are improvements in the ASP.NET runtime that extend application management, handling of session state and the ability to leverage extensibility in caching.
  • ASP.NET MVC 2 is included in the Visual Studio 2010 install and you get some new advances such as strongly-typed helpers like TextBoxFor, improved templated helpers, improvements in validation based on annotations on the model, advances in partial
    rendering and finally ‘areas’ to organize your application more easily.  
  • Visual Studio 2010 makes developing and deploying your application easier with multi-monitor support, new Web project templates, faster and dynamic JavaScript intellisense, snippets, broader CSS 2.1 support.  You also now have the ability to package
    and publish your web application including IIS settings, SQL scripts, file certs and transform your configuration files seamlessly in one publishing command.

You can download ASP.NET 4 and Visual Studio 2010 via the
Web Platform Installer
, or directly as part of
.NET 4
or Visual Studio 2010.

For a detailed list of ASP.NET 4 improvements, see our
whitepaper
. Additional details can be found
here
, MSDN and the series on Scott Guthrie’s blog or on 
Scott Hanselman’s
blog. There is also a breaking changes document, if you need specific details, see
here

Many Thanks!

The ASP.NET and Visual Web Developer Teams!

[RESOLVED]Element 'LinqDataSource' is not a known element … VS 2010 ASP.Net 4.0

I’m getting the below warning error in Visual Studio 2010 when I create a new ASP.Net 4.0 Web Application (WebForms or MVC2).

Element ‘LinqDataSource’ is not a known element…

I open VS, click on "New Project…", select Web / ASP.NET Web Application (.NET Framework 4).

Open the Default.aspx page

Double-click on LinqDataSource in the Toolbox

… and the LinqDataSource is inserted, but it contains no defaulted ID attribute, and there’s the above warning error.

I’ve done some Googling (if that’s a word) and found references to this problem in older (3.5 and prior) framework versions which suggest checking that the following exists in web.config:

<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">
<pages></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">
<controls></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x:
hidden; overflow-y: hidden;" id="_mcePaste">
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x:
hidden; overflow-y: hidden;" id="_mcePaste">
</controls></div> <div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste">
</pages></div> <div></div>

<pages>

<controls>

<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

</controls>

</pages>

<div>
</div><div>I don’t see these in the web.config for an ASP.Net 4.0 project, and from what I’ve read you shouldn’t need these in 4.0.</div><div>
</div><div>Am I doing something wrong?  Does anyone have any suggestions as to how to make the warnings go away?</div><div>
</div><div>Thanks!</div><div>
</div>

LinqDataSource is not a good control to be using for serious apps. I think its still used quite heavily in Dynamic Data but in most cases you should try to use the ObjectDataSource so that you can cleanly separate your concerns.

Lecturing you aside ([:)]) have you tried clicking the Website menu then choosing Add Reference and adding in a reference to System.Data.Linq? Actually not sure if its in that assembly. Its probably somewhere else but not sure where from MSDN docs:

Also are you sure you have targetted 4.0?

My question isn’t regarding the appropriateness of using the LinqDataSource control (Lecture noted), but that the IDE doesn’t seem to fully recognize its existance.

Yes, there is a reference listed for "System.Data.Linq" under the "References" folder.

I also see the same behavior when attempting to add the following controls to a default.aspx page:

  • DataPager
  • EntityDataSource
  • LinqDataSource
  • ListView
  • QueryExtender

Interestingly however, when I add the "Chart" control to the page, it adds the following line at the top of Default.aspx, and all warnings disappear!

<div style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;" id="_mcePaste"><%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %></div> <div></div>

<%@ Register Assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" Namespace="System.Web.UI.DataVisualization.Charting" TagPrefix="asp" %>

<div>
</div><div>Very odd …</div><div>
</div><div>And yes, I am targeting 4.0.</div>

Might be your schema cache. Can you try the workaround mentioned in
this
post? 

Eureka!  That took care of it!

Thank you Bala!

I simply cleared my schema cache (see below) and my warnings went away…

As a workaround, you can try the following: 

Close VS, delete schema cache, and re-open VS. You can find the schemas under something like:

C:UsersPavelAppDataRoamingMicrosoftVisualStudio10.0ReflectedSchemas

 

It is safe to delete all files in this folder.

[RESOLVED]show data in datalist using RangeExpression

i have two drodownlist  which shows minimum and maximum price

i wants to show all products ranges between this two drodownlist value using RangeExpression

this both drodownlist are in master page,now when i click on submit button all this product should be shown in another page within that price range

so ,what should i do,i i should use querystring than what should i pass in it

i have done this

 <asp:LinqDataSource ID="LinqDataSource1" runat="server" 
                  ContextTypeName="linqextenderDataContext" EntityTypeName="" 
                  TableName="Products" Where="Category == @Category">
                  <WhereParameters>
                      <asp:ControlParameter ControlID="dropcategory" Name="Category" 
                          PropertyName="SelectedValue" Type="String" />
                  </WhereParameters>
              </asp:LinqDataSource>
              <asp:QueryExtender ID="QueryExtender1" runat="server" TargetControlID="LinqDataSource1">
                <asp:RangeExpression DataField="Price" MinType="Inclusive" MaxType="Inclusive">
                    <asp:ControlParameter ControlID="dropmin" Type="Int32" PropertyName="SelectedValue" />
                    <asp:ControlParameter ControlID="dropmax" Type="Int32"  PropertyName="SelectedValue" />                                                                                      
                </asp:RangeExpression>
              </asp:QueryExtender>

<asp:Button ID="btnsubmit" runat="server" Text="Submit" 
                  style="margin-left:50px" onclick="btnsubmit_Click"/>
protected void btnsubmit_Click(object sender, EventArgs e)
    {
       Response.Redirect("products.aspx");        
    }

Hi viks,

You need to access the price range to the products page, so you can use the following code to find the price range:

DropDownList ddlmin = this.MasterPage.FindControl("dropmin") as DropDownList;
DropDownList ddlmax = this.MasterPage.FindControl("dropmax") as DropDownList;

And then you can use the questring or session to access the value to another page, like this:

protected void Button_Click(object sender, EventArgs e){
DropDownList ddlmin = this.MasterPage.FindControl("dropmin") as DropDownList;
DropDownList ddlmax = this.MasterPage.FindControl("dropmax") as DropDownList;
//you can use the session to access the value of price range
Session["min"] = ddlmin.SelectedValue;
Session["max"] = ddlmax.SelectedValue;
//you can also use the querystring to access these value
Response.Redirect("product.aspx?min="+ddlmin.SelectedValue+“&max="+ddlmax.SelectedValue);
}

Hope it helps.

Best Regards,
Terry Guo

New JQueryExtenderControl with Latest Toolkit Release

Just wondering if anyone has found any examples of how to use this new control.  

I have found the following link and have looked at the toogle button control

http://stephenwalther.com/archive/2013/09/30/ajax-control-toolkit-now-supports-jquery

but have no clue how to start from scratch.

Hi Mustang65,

Thank you for posting to asp.net forum.

From your description and link you provided, I see you noticed the Ajax Control Toolkit which released in September 2013.

In this artitle, it introduced the jQueryExtender and other changes. It explained very clear, jQueryExtender enables you to create Ajax Control Toolkit controls

with jQuery instead of the Microsoft Ajax Library. To explain that, author provided an example for how to using ToggleButton.

You can get all tha other changes from the links provided by Stephen Walther in this article.

And for how to use this controls, I’d like suggest you still refer to the link below.

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/Default.aspx

 

Hope this helps. Thanks.

 

Best Regards! 

The point of my question is that I have been trying to get a control to work with the jQueryExtender.  I have been trying to duplicate that ToggleButton. But everything I do fails, therefore I am asking for an standalone example that is not built within
the Toolkit so that it would show all of the pieces that are need to build your own control.

The first part I had problems with was just getting the script to show up, the code above the namespace 

[assembly: System.Web.UI.WebResource("TestToggleButtonExtender.mplToggleButtonExtender.js", "text/javascript")]

and the following on the c;lass item

    [ClientScriptResource(null, "TestToggleButtonExtender.mplToggleButtonExtender.js")]

Does not work, at least the way I have it set up.  I have by cs file and js file in the same exact directory.

I finally had to add 

protected override IEnumerable<ScriptReference>
              GetScriptReferences()
        {
            yield return new ScriptReference("TestToggleButtonExtender.mplToggleButtonExtender.js", this.GetType().Assembly.FullName);
        }

to the code to get it to pick up the javascript file.

No the problem is that for some reason jQuery itself is not passed to the script so all I can do right now is generate a jQuery Extender that does an Alert and log to the console.

I just wish there was a better example showing me all of the other pieces tht need to be included.

I just made some headway on getting jQuery passed into the new extender,  it seems you must pass in actJQuery for the jquery instance.  From what I would guess is this is what the Toolkit has changed jQuery to user within the extenders, it would also use
the same version that is embedded in the toolkit, which is 1.9.1.  I still dont understand why the ClientScriptResource part does not work.

How to solve <asp: PropertyExpression> error

I get the following error on the web page after I use "View in Browser" in Visual Web Developer. I think <asp: PropertyExpression> is missing in some namespaces and I have tried without success. Please advise.

Source Error: 

Line 48:     <asp:QueryExtender ID="qeCustomers" runat="server" TargetControlID = "edsCustomers" >
Line 49:         <asp:SearchExpression SearchType ="EndsWith">
Line 50: <asp:PropertyExpression> 
Line 51:                 <asp:ControlParameter ControlID = "DropDownList1" Name="Country" />
Line 52:             </asp:PropertyExpression>

What the exception message?

The following is the message displayed on the web page.

 Server Error in ‘/’ Application.


Parser Error

Description:
An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.

Parser Error Message: System.Web.UI.WebControls.ParameterCollection must have items of type ‘System.Web.UI.WebControls.Parameter’. ‘asp:PropertyExpression’ is of type ‘System.Web.UI.WebControls.Expressions.PropertyExpression’.
Line 48:
 .    same as last message.

Line 52

In the VWD, there are green lines under "PropertyExpression",
"ControlParameter",
"OrderByExpression".
When I point the mouse pointer to the green line of "PropertyExpression", this message "Element ‘PropertyExpression’ is not a known element. This can occur if there is a compilation error in the web site or web.config file is missing". " appears. 

This
is what I can tell.

—————-listing from VWD——————-

<asp:PropertyExpression>

   
<asp:ControlParameter
ControlID
=
"DropDownList1"
Name="Country"
/>

</asp:PropertyExpression>

<asp:OrderByExpression
DataField
="Country"
Direction
=
"Ascending"
/>

—————end of listing——————

Thanks for your help

 

Query Extender filtering data by a field in related table.

I am trying to use a query extender to filter my entity data source  as shown below:

<asp:EntityDataSource ID="Equipment_DS" runat="server"   ConnectionString="name=FieldEquipmentEntities" DefaultContainerName="FieldEquipmentEntities" 
             EnableFlattening="False" EntitySetName="lu_Equipment" >    
</asp:EntityDataSource>
<asp:QueryExtender TargetControlID="Equipment_DS" ID="EqQueryExtender" runat="server">            
            <asp:CustomExpression OnQuerying="FilterEq" />           
     </asp:QueryExtender>
protected void FilterEq(object sender, CustomExpressionEventArgs e)
            {

            using (var db = new FieldEquipmentEntities())
            {

                e.Query = from a in e.Query.Cast<lu_Equipment>()
                          join t in db.TransferDetails on a.Eq_number equals t.Eq_number
                          where t.Trans_StatusId ==5
                          select a;        

            }
        }

But the above code for FilterEq method does not work ..Can someone please guide me if my LINQ statement is wrong.

Error: 

LINQ to Entities does not recognize the method ‘System.Data.Entity.Core.Objects.ObjectQuery`1[FieldEquipmentInventory.Models.TransferDetail] MergeAs(System.Data.Entity.Core.Objects.MergeOption)’ method, and this method cannot be translated into a store
expression.

Thank you

If you change

 e.Query = from a in e.Query.Cast<lu_Equipment>()
                          join t in db.TransferDetails on a.Eq_number equals t.Eq_number
                          where t.Trans_StatusId ==5
                          select a;        

to:

 e.Query = from a in db.yourtable
                          join t in db.TransferDetails on a.Eq_number equals t.Eq_number
                          where t.Trans_StatusId ==5
                          select a;        

Does this work?

For more information, please refer to

join clause (C# Reference)