MVC :: IQueryable Casting To IOrderedQueryable Doesn't Work?
Nov 10, 2010
I am passed an IQueryable that might be already be ordered and that therefore might be an OrderedQueryable. I need to apply it a new ordering via reflection, anb before choosing if calling either OrderBy or ThenBy I need to now if the Queryable is IOrderedQueryable.
Now comes the problem! To see if may variable say query is an IOrderedQueryable I do:
IOrderedQueryable orderedQuery = query as IOrderedQueryable;
One might expect orderedQuery be null in case query is not an IOrderedQueryable ! INSTEAD orderedQuery is NEVER NULL. It takes the value of a different type!
I understand that this might happen because of deferred execution...
I tried also: query is IOrderedQueryable and it is always true!
How can I verify if query is actually an IOrderedQueryable before getting an exception when calling ThenBy?
The IQueryable comes from the Entity Framework 4.0
I am able to see it if I access the object that is behind the interface, but this way I would loose the benefif of using interface, and my class might not work with a different implementation of the IQueryable.
View 2 Replies
Similar Messages:
Oct 7, 2010
i'm trying to make this work for several days but it just doesn't work.
this is my code:
aspx page:
[Code]....
webservice:
[Code]....
this was downloaded from this website.
the problem is that the page loads fine but no autocomplete occurs.
View 5 Replies
May 11, 2010
I am a new to WCF. I have written ajax to use a web service before, but on this project I am trying to use ajax to WCF.After I build the project and wcf using ajax, I receive the return successfully. But, 10 or more minutes later I don't get a return, the ajax calls the error function, and the fiddler returns nothing.
If I rebuild the project without any source modifying, I receive the return successfully again.
View 2 Replies
Feb 3, 2010
I am trying to save an updated xml file to a url like this:
Quote:
//save the output to a file
xmlDoc.Save("http://www.example.com/HomeNewsLinks.xml");
But I get this error: URI formats are not supported.
Did some google search on this and it seems I need to use client.uploadFile method, but I am not able to find how to declare/define filenamexxx (below) and how to pass a username/password.
Quote:
WebClient Client = new WebClient();
Client.UploadFile("http://www.example.com/HomeNewsLinks.xml", Post, filenamexxx);
View 5 Replies
Aug 10, 2010
I used this,
<a title="Logout" onclick="javascript:document.getElementById('ctl00_ContentPlaceHolder1_LbLogout').click();" href="#" class="logout">Logout</a></li>
<asp:LinkButton ID="LbLogout" runat="server" style="display:none"
onclick="LbLogout_Click">Sign out</asp:LinkButton>
View 2 Replies
Jul 14, 2010
I am following though the examples in Professional ASP.Net MVC 2 and one of the examples doesn't work for me.
[HttpPost]
public ActionResult Edit (int id, FormCollection collection)
{
Dinner dinner = dinnerRepository.GetDinner(id);
if (TryUpdateModel(dinner))
{
dinnerRepository.Save();
return RedirectToAction("Details", new { id = dinner.DinnerID });
}
return View(new DinnerFormViewModel(dinner));
}
I understand that it's suppose to take the values from the FormCollection, and then update the dinner object with it, bit I don't see the collection get referenced anywhere.
View 2 Replies
Aug 31, 2010
I have div which it is hidden by default , when the use clicks show link the following javascript method is called:
function ChangeControlVisibility(elementID) {
var element = $("#" + elementID);
if (element.css('display') != 'block' && element.css('display') != 'table') {
element.show();
[code]....
this step works but when i call the previous method at page_load event the method doesn't work:
element.css('display') undefined.
View 3 Replies
Jul 27, 2010
[Code]....
And in default.aspx, the code is
[Code]....
But it is not working, the error is at alert(BiblePeopleArray(0));
View 4 Replies
Apr 1, 2010
I have a Gridview in UpdatePanel and a textbox in which i input a string, the row is searched from gridview onkeyup of textbox.For example when i entered "testing" one row is displayed in gridview having "Edit" command and when i clicked on "Edit" it goes to top of the row having another data is converted into edit mode but that rows is not changed into textbox.
View 8 Replies
Sep 26, 2010
I have such entities
Then I tried to retrieve node type from Node this way - Nodes node = Entities.Nodes.First(); string nodetype = node.NodeTypes.Name; but for some reason node.NodeTypes equalls null despite fact that there is some records in NodeTypes table.
View 3 Replies
Mar 18, 2011
I have a listview in which I use a pager control. When I have more than 1 item in the list view, I want the user to be able to click on the appropriate page number and go to it. Simple right?, right now the first time the user clicks on the page number, nothing changes. If they click on it again, it goes right to the page. It doesn't matter what page they click on, it ALWAYS requires a second click to display the data item.
I am using VS2010 C# as the code behind.
View 4 Replies
Mar 31, 2011
I know that UpdateProgress doesn't work with PostBackTrigger, but let me explain what i'm trying:
I'm generating a PDF document (Crystal Report) with ExportToHttpResponse that will be downloaded automaticaly by the browser.
So while the document is been generated, i'd like to show the UpdateProgress just while i'm waiting the doc is being generated, doing the UpdateProgress(or some label) to disappear.
View 3 Replies
Jan 12, 2011
I've been trying to fix something on a secure website (https) which is an Export to Excel button that generates a CSV file. It works on Firefox, Chrome , etc... but not in Internet Explorer. I have changed the headers eliminating the no-cache and also edited the IIS http header configuration setting an expiration date of 1 day. I have no idea of what can be going on and how to solve it. Do you guys have any idea of how to fix this stuff ? I've read so many posts and they're all saying the same thing... caching.
UPDATE 1 :
regarding the error I receive, I receive an IE Alert saying "Internet explorer cannot download filename.aspx from [URL]Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later. As I said, it all works out of SSL (https), but the export to excel button, breaks in https.
UPDATE 2:
I'm using these headers:
Response.ClearContent();
Response.Clear();
Response.Buffer = true;
Response.AddHeader("content-disposition", "attachment; filename=" + name.Trim() + ".csv");
Response.AddHeader("Cache-Control", "no-cache");
Response.AddHeader("Pragma", "public");
Response.AddHeader("Content-Transfer-Encoding", "binary");
Response.AddHeader("Content-Length", "2026");
Response.Charset = "";
//Response.ContentType = "application/vnd.ms-excel";
Response.ContentType = "text/csv";
View 2 Replies
Dec 21, 2010
i've log-in page in my site but log-in control doesn't work on any browser other than IE.
View 1 Replies
Mar 2, 2010
Iam trying to use a UserControl named CheckBoxControl as value for the ExpandControlID/CollapseControlID attributes of the CollapsiblePanelExtender. It works fine when I use a normal CheckBox instead.
<uc:CheckBoxControl ID="ucHaftpflicht" runat="server" OnCheckedChanged="UpdateStatus" ControlLabel="Haftpflicht" />
<asp:Panel ID="HaftpflichtPanel" runat="server">
</asp:Panel>
<asp:CollapsiblePanelExtender ID="CollapsiblePanelExtender" runat="server" CollapseControlID="ucHaftpflicht.CheckBox" ExpandControlID="ucHaftpflicht.CheckBox" TargetControlID="HaftpflichtPanel" />
When I run the site, most ajax controls on my site disappear and I get following errors in firefox script error console:
Fehler: Sys.InvalidOperationException: Handler was not added through the Sys.UI.DomEvent.addHandler method.
Fehler: Sys.ArgumentException: Failed to find element "ucHaftpflicht.CheckBox"
Parameter name: CollapseControlID
View 1 Replies
Mar 17, 2010
The forms works fine in Firefox and I was able to get an email from it. Here is the code below:
Partial Class _Default
Inherits System.Web.UI.Page
''' <summary>
''' Actions when the Send button is clicked.
''' </summary>
'''
Protected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.Click
If Not Page.IsValid Then Exit Sub
'Create instance of main mail message class.
Dim mailMessage As System.Net.Mail.MailMessage = New System.Net.Mail.MailMessage()
'Configure mail mesage
'Set the From address with user input
mailMessage.From = New System.Net.Mail.MailAddress(txtEmailAddress.Text.Trim()).........
View 2 Replies
Aug 25, 2010
i have set of link buttons outside update panel but when click any one of them they donot work at all , when i set the postbackUrl they make full postback my source code :
<asp:Panel ID="pnl_viewImages" runat="server">
<asp:Label ID="lbl_viewImages" runat="server" style="texalign: left"
Text="view images :"></asp:Label>
<br />
<br />
<br />
<table cellpadding="0" cellspacing="0" style="width: 100%" class ="Alternating">
<tr>
<td colspan="5">
<asp:UpdatePanel ID="updatePnl_image" runat="server">
<ContentTemplate>
<asp:ListView ID="lv_showImages" runat="server">
<ItemTemplate>
<asp:Image ID="img_showNewsImage0" runat="server" Height="300px"
ImageUrl='<%# "RetreiveImage.ashx" %>' Width="413px" />
</ItemTemplate>
</asp:ListView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="lbtn_first" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="lbtn_last" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="lbtn_next" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="lbtn_previous" EventName="Click" />
<asp:AsyncPostBackTrigger ControlID="lbtn_delete" EventName="Click" />
</Triggers>
</asp:UpdatePanel>
</td>
</tr>
<tr>
<td>
<asp:LinkButton ID="lbtn_first" runat="server" onclick="lbtn_first_Click">first</asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="lbtn_previous" runat="server" onclick="lbtn_first_Click"><<</asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="lbtn_next" runat="server" onclick="lbtn_first_Click"
>>></asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="lbtn_last" runat="server" onclick="lbtn_first_Click">last</asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="lbtn_delete" runat="server" onclick="lbtn_first_Click">delete</asp:LinkButton>
</td>
</tr>
</table>
<br />
</asp:Panel>`
i tried to remove the table but in vain it does not work also.
View 2 Replies
Jan 20, 2011
I´m using in my application the control :ModalPopUpExtenter. In my computer testing localhost, it works fine. But when i put my application on my server, everything works fine except the ModalPopUp.In the page that i use it, my panel is appearing for my user, but i don´t receive any error message.I pute the dlls: AjaxControlToolkit.dll, System.Web.Extensions.dll and System.Web.Extensions.Design in the folder bin.
View 2 Replies
Aug 31, 2010
I have the following class that I have all my controllers inherit from:
[Code]....
I would like to aways redirect to the login page where // this isn't workingThe current code runs, but it still allows access to the views that I want to block when the user isn't logged in
View 4 Replies
Jan 22, 2010
I've got a problem with my title displaying with the default template. It gets cutoff in firefox and IE 8 (in standards mode) by the content div.
View 1 Replies
Aug 5, 2010
I'm currently developping an application using MVC2 and Globalization (fr and de). I'm creating a form who use DataAnnotation on the model for validation, with localized error messages in my dataAnnotations.
Here is the trick :
I have two <input /> :
One for a required date (example : 12/05/2001) wich is a DateTime field in the model :
[Code]....
One for an optionnal hour (example : 22:30) wich is a DateTime? :
[Code]....
Erreur and LibellesSinistre are my ressources files.
I got two problems :
I can enter a date in my hour field and an hour in my date field.My error messages aren't localized.
Do I need a trick or something to make it work ?
View 5 Replies
Jul 13, 2010
I´m trying to use ImageButton to link to another page. ImageButton is inside a Repeater and the code is following:
<ul id = "ulMap">
<asp:Repeater ID="Repeater1" runat="server" >
<ItemTemplate>
<li>
<asp:ImageButton ID="ImageButton1"
CommandArgument='<%#Eval("Nav_ID") %>'
runat="server"
[code]...
View 3 Replies
Mar 24, 2011
I have a problem. I have done custom "Remember Me" functionality using cookies.
[code]....
I see the cookie in firecookies tools in the Firefox. It exists and has the correct expiration date.
But when I changed time - moved to next month. After that I entered to the site and I unlogged user.
View 1 Replies
May 11, 2010
I'm trying to upgrade my mvc 1.0 application that had a custom written login. I assign the authcookie like this:
[code]...
And here if I debug _authRoles has "Admin" in it, and isAuthorized is always false.
If I check the "ticket" it has some: UserData = "Admin".
What can be wrong there? Is it the "User.IsInRole" that is different, or do I need to add something in web.config?
View 1 Replies
Feb 4, 2010
I'm using routing from System.Web.Routing without MVC in a standard ASP.Net Web Application Project application. This is mostly done to get neater urls in the portal we are developing (instead of ~/default.aspx?contentid=123 we have ~/{contentsubject}. The portal is not authorized and all info is in the url so in a caching scenario we can cache complete pages.
When I tried to enable output caching I noticed that no caching was done. It seems that the outputcache page directive is completely ignored. Is this true or am I missing something? Can this be fixed?
I made a small test app (I uploaded it to [URL] that just contains a page, Webform1.aspx, that uses a master page and a user control. All three output the current date and time.
When I request http//localhost/OutputcacheTest/Webform1.aspx the 10 second caching works as expected, i.e. the shown time only updates every 10 seconds.
The app also defines a wildcard route that catches all requests and returns the same Webform1.aspx as a handler. So when requesting http//localhost/OutputcacheTest/myroute the same page is executed but now the caching doesn't work, i.e. the current time is shown on every request.
Note: When using the built-in development web server both scenarios work, only IIS seems to have this problem.
Does anyone have a a solution or work around for how to enable output caching in this scenario?
View 2 Replies