asp.net-ajax

How may I best use the [Authorize] attribute with Ajax and Partial Views?

非 Y 不嫁゛ 提交于 2019-11-27 13:16:48
问题 I was about to use [Authorize] on Actions that return partial views through Ajax; but I'm not getting the behavior I'd like (although its the behavior I expected). It seems like a long shot; but, is there any way to extend this attribute to "break out" of an AJAX call and redirect the entire page to the login screen? (As opposed to returning the login screen to whatever location I've set UpdateTargetId?) I think I have a handle on how I'd do this on each of the specific Ajax calls, but if I

Calling a WebMethod using jQueryAjax “GET”

萝らか妹 提交于 2019-11-27 12:59:10
问题 i have a ajax request which works well using "POST" but when used "GET" it gives me the following error, {"Message":"An attempt was made to call the method \u0027GetSomething\u0027 using a GET request, which is not allowed.","StackTrace":" at System.Web.Script.Services.RestHandler.GetRawParams(WebServiceMethodData methodData, HttpContext context)\r\n at System.Web.Script.Services.RestHandler.ExecuteWebServiceCall(HttpContext context, WebServiceMethodData methodData)","ExceptionType":"System

What's the different between ASP.NET AJAX pageLoad() and JavaScript window.onload?

余生长醉 提交于 2019-11-27 12:10:39
I'm working with ASP.NET AJAX and want to understand the difference between these two snippets: function pageLoad(sender, eventArgs) { } and window.onload = function() { } Do they act the same? Or is one called before the other? Or will one be called automatically and the another not? A couple things to note first. MS invented a sort of "clientside runtime object" called Sys.Application . It handles raising init , load , and unload events throughout the [clientside] lifespan of the page, as follows: Sys.Application.initialize() begins the init part of the life cycle. This initialize() s all

ModalPopupExtender OK Button click event not firing?

时光怂恿深爱的人放手 提交于 2019-11-27 11:53:34
问题 I have a Button inside an UpdatePanel. The button is being used as the OK button for a ModalPopupExtender. For some reason, the button click event is not firing. Any ideas? Am I missing something? <asp:updatepanel id="UpdatePanel1" runat="server"> <ContentTemplate> <cc1:ModalPopupExtender ID="ModalDialog" runat="server" TargetControlID="OpenDialogLinkButton" PopupControlID="ModalDialogPanel" OkControlID="ModalOKButton" BackgroundCssClass="ModalBackground"> </cc1:ModalPopupExtender> <asp:Panel

Stackoverflow Style Notifications in asp.net Ajax

和自甴很熟 提交于 2019-11-27 11:46:13
问题 When you get a badge or aren't logged in to stack overflow there's a groovy little notification bar at the top of the page that lets you know there's something going on. I know the SOflow team use JQuery, but I was wondering if anyone knew of an implementation of the same style of notification system in asp.net AJAX. On a side note, what's the "official" name for this style of notification bar? 回答1: I like it to. div tag with a fade. http://www.asp.net/AJAX/AjaxControlToolkit/Samples

How do I force full post-back from a button within an UpdatePanel?

孤者浪人 提交于 2019-11-27 11:45:01
How do I force full post-back from a button within an UpdatePanel? You can use the Triggers property of the UpdatePanel to register actions that trigger a full postback. Add a PostBackTrigger object to that property, containig the ControlID of the control which needs to trigger a full postback. <asp:UpdatePanel ID="UpdatePanel1" UpdateMode="Conditional" runat="server"> <ContentTemplate> ... </ContentTemplate> <Triggers> <asp:PostBackTrigger ControlID="myFullPostBackControlID" /> </Triggers> </asp:UpdatePanel> Just adding this because nobody else has. It is possible to do this in code-behind in

Full postback triggered by LinkButton inside GridView inside UpdatePanel

大城市里の小女人 提交于 2019-11-27 11:33:55
I have a GridView inside of a UpdatePanel. In a template field is a button I use for marking items. Functionally, this works fine, but the button always triggers a full page postback instead of a partial postback. How do I get the button to trigger a partial postback? <asp:ScriptManager ID="ContentScriptManager" runat="server" /> <asp:UpdatePanel ID="ContentUpdatePanel" runat="server" ChildrenAsTriggers="true"> <ContentTemplate> <asp:GridView ID="OrderGrid" runat="server" AllowPaging="false" AllowSorting="false" AutoGenerateColumns="false"> <Columns> <asp:TemplateField HeaderText="">

ASP.NET MVC modal dialog/popup best practice

本秂侑毒 提交于 2019-11-27 11:25:24
I am looking for the most standard way to achieve modal dialogs in ASP.NET MVC. An example of what I am trying to do is when I select an item from my "list" page, I want the "details" page to be a popup over the list and NOT a new page. I'm not looking for a hack. I want it to be a solution that follows the ASP.NET MVC pattern. I would also prefer not stepping outside jQuery and ASP.NET Ajax (no plugins UNLESS it is emerging as a best practice). Lunchy's dialog suggestion is nice. Just make an ajax request to your controller action and have the action return what you want to display, like a

Programmatically Adding User Controls Inside An UpdatePanel

允我心安 提交于 2019-11-27 11:20:51
问题 I'm having trouble dynamically adding controls inside an update panel with partial postbacks. I've read many articles on dynamic controls and I understand how to add and maintain them with postbacks but most of that information doesn't apply and won't work for partial postbacks. I can't find any useful information about adding and maintaining them with UpdatePanels. I'd like to do this without creating a web service if it's possible. Does anyone have any ideas or references to some helpful

One Update Panel vs. Multiple Update Panels [closed]

孤街醉人 提交于 2019-11-27 10:42:39
问题 I have an ASP.NET web page that displays a variety of fields that need to be updated best on certain conditions, button clicks and so on. We've implemented AJAX, using the ASP.NET Update Panel to avoid visible postbacks. Originally there was only one area that needed this ability ... that soon expanded to other fields. Now my web page has multiple UpdatePanels. I am wondering if it would be best to just wrap the entire form in a single UpdatePanel, or keep the individual UpdatePanels. What