asp.net-ajax

AJAX & ASP.net, Referencing server controls in external file

∥☆過路亽.° 提交于 2019-12-12 12:29:10
问题 I've got some JavaScript in an ASP.NET page that looks like this: var list = $get('<%=Topics.ClientID %>'); I have many functions written now where this syntax is used, and I would like to centralize my JavaScript and move this into an external JavaScript file. This breaks however, since 'Topics' cannot be found. What is the best strategy for getting this to work? I assume I should pass the control/control information as a parameter to the function, but I can't seem to get the syntax to work.

XMLHttpRequest() not recognized as a IsAjaxRequest?

百般思念 提交于 2019-12-12 11:26:08
问题 To redirect user to sign in page when session timed out for Ajax request, I implemented following custom attribute, Code related to Unauthorize request is as follows, protected override void HandleUnauthorizedRequest(AuthorizationContext filterContext) { if (filterContext.HttpContext.Request.IsAjaxRequest()) { filterContext.HttpContext.Response.StatusCode = 403; filterContext.Result = new JsonResult { Data = new { Error = "SessionTimeOut" }, JsonRequestBehavior = JsonRequestBehavior.AllowGet

AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced

假如想象 提交于 2019-12-12 10:58:54
问题 Recently I started working on VS2010 and I am referencing AjaxControlToolkit 4.1.51116.0. I am getting below runtime error - Microsoft JScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll. I have seen many question floating for same error but the solution suggested is to use 'ToolkitScriptManager' instead of

How to use Html.Raw(Json.Encode(Model)) properly?

拟墨画扇 提交于 2019-12-12 09:43:56
问题 I'm trying to Encode my MVC Model with the following code but the alert message gives me a null value. I'm not sure why it's giving me a null value because this is a create form. I'm trying to create a model from this and my html Code has the following look: @using (Html.BeginForm()) { @Html.AntiForgeryToken() <div class="form-horizontal"> <h4>Customer</h4> <hr /> @Html.ValidationSummary(true, "", new { @class = "text-danger" }) <div class="form-group"> @Html.LabelFor(model => model.Name,

ASP.NET MVC jQuery autocomplete with url.action helper in a script included in a page

瘦欲@ 提交于 2019-12-12 09:18:23
问题 I have been building my first ASP.NET MVC web app. I have been using the jQuery autocomplete widget in a number of places like this: <head> $("#model").autocomplete({ source: '<%= Url.Action("Model", "AutoComplete") %>' }); </head> The thing is I have this jQuery code in a number of different places through my web app. So i thought I would create a seperate javascript script (script.js) where I could put this code and then just include it in the master page. Then i can put all these repeated

ASP.Net MVC 3.0 Ajax.ActionLink Onbegin Function true the execute the action?

人盡茶涼 提交于 2019-12-12 09:11:02
问题 I have a Ajax Action link, which will call a action Method, In my Ajax Option i have called a Validate function, If this function returns true, then only i would want this Action Execute, not sure how i can get this done? My Ajax ActionLink Ajax.ActionLink("Renew", "Edit", "Controller", new { id = "<#= ID #>" }, new AjaxOptions { OnBegin = "isValidDate", OnSuccess = "DestroyRecreateAccordion", UpdateTargetId = "accordion", InsertionMode = InsertionMode.InsertAfter, }, new { @class = "standard

Using JQuery UI datepicker inside UpdatePanel [duplicate]

依然范特西╮ 提交于 2019-12-12 08:29:09
问题 This question already has answers here : jquery datepicker ms ajax updatepanel doesn't work after post back (9 answers) Closed 6 years ago . I'm trying to use UpdatePanel control and Jquery UI for date picker. But if date picker control (TextBox) is inside UpdatePanel's ContentTemplate, then date picker does not works. Here is the code: <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script src="Scripts/jqueryui/js/jquery-ui-1.8.8.custom.min.js" type="text/javascript">

Can I use UpdatePanel in MasterPage to wrap nested pages?

一曲冷凌霜 提交于 2019-12-12 07:35:46
问题 Can I use Update panel in masterpage to wrap nested pages so that when browsing from one page to the other client only gets a partial refresh (MasterPage doesn't get reloaded). If so - how? Do I Just put an update panel around the ContentPlaceholder in the Master Page? Any help appreciated! 回答1: I do not advise you to wrap an entire page in an UpdatePanel , for the following reasons: If you want your site to be index by Search Engines, you will need to display your content on separate pages .

ASP.NET Register Script After Partial Page Postback (UpdatePanel)

我是研究僧i 提交于 2019-12-12 07:24:06
问题 I have a simple form (textbox, submit button) which is wrapped in an update panel. <asp:UpdatePanel ID="ReplyUpdatePanel" UpdateMode="Conditional" runat="server"> <ContentTemplate> <asp:Textbox id="ReplyTextBox" runat="server"/> <asp:Button id="SubmitButton" OnClick="SubmitButton_Click" runat="server"/> <ContentTemplate> </asp:UpdatePanel> So, when i click the button, the server-side click event is fired (SubmitButton_Click), stuff happens to the db, and the page is re-rendered

Enabling/disabling CascadingDropDown using jquery

∥☆過路亽.° 提交于 2019-12-12 06:14:06
问题 Greeting; I have asp.net dropdownlist control with Ajax CascadingDropDown control. I also I have asp.net checkbox control. I want to enable/disable CascadingDropDown when the checkbox checked/unchecked using jquery. I tried diffrent ways but they did not work and if I want to set enable property for the dropdownlist to false it will not work so I have to set the CascadingDropDown enable property to false to disable it but I do not know how. this is one of the code I tried: <asp:CheckBox ID=