asp.net-ajax

JavaScript runtime error for Microsoft AJAX scripts

孤街醉人 提交于 2019-12-12 05:06:31
问题 I have an ASP.NET web forms project in VS.NET 2012 that has been running great for weeks. All of the sudden out of nowhere I'm getting the following everytime I begin to debug the project: Unhandled exception at line 1, column 12302 in http:// localhost :1449/bundles/MsAjaxJs?v=_Onj24X0Yu7cK2nh78YBmVwMlQTGcakS5HZSOI_a6SM1 0x800a139e - JavaScript runtime error: Sys.InvalidOperationException: The script 'Timer.js' has been referenced multiple times. If referencing Microsoft AJAX scripts

Value cannot be null. Parameter name: control

旧时模样 提交于 2019-12-12 05:03:09
问题 I used to have the UpdatePanel as a wrapper for the whole Listview item. <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:ListView ID="ListView1" runat="server"> <LayoutTemplate> <asp:PlaceHolder id="itemPlaceholder" runat="server" /> </LayoutTemplate> <ItemTemplate> '.... </ItemTemplate> </asp:ListView> </ContentTemplate> <Triggers></Triggers> </asp:UpdatePanel> and register the client script as follows... Private Sub ListView1_ItemCommand(ByVal sender As Object,

How to use AJAX in master page when content pages have ScriptManager?

倖福魔咒の 提交于 2019-12-12 04:42:59
问题 In my ASP.NET 3.5 project, most content pages have ScriptManager control but the Master Page does not have. I now want to use UpdatePanel in the master page but it is not permitting to put another ScriptManager. I cannot change to ScriptManagerProxy in content pages as the change needs to be replicated to around fifty pages. Is there any way to use UpdatePanel in Master Page by either sharing content page's ScriptManager or something else? 回答1: three ways I can think. First way is to use

How to Grab data from database using JQuery Sortable and post data back

こ雲淡風輕ζ 提交于 2019-12-12 04:29:36
问题 I am attempting to create a menu that allows the user to re order the list items into a new order. The list data is pulled from a database. I've coded the jQuery sortable functionality feature for my menu however, I am struggling to then save the data in the new order back to model after the user has re ordered the list. This is my code for the sortable, it all works except for the line with var objmodel . When this variable is created it manages to grab an empty object from the database and

ScriptManager duplicates javascript

点点圈 提交于 2019-12-12 03:54:14
问题 I have a usercontrol that can be used in for example a gridview itemtemplate, this means that the control might or might not be on the page at page load. In the case where the control is inside an itemtemplate i will popupate the gridview via asynchronous postbacks (via updatepanels). The control itselfs registrers scriptblocks since it is depending on javascripts. First i used Page.ClientScript.RegistrerClientScriptBlock But this doesn't work on asynchronous postbacks (updatepanels) so i

Listening to the keyPressed event, Razor

﹥>﹥吖頭↗ 提交于 2019-12-12 03:38:07
问题 <body> <table align="center" width="100%" height="100%"> <tr> <td align="center" id="previousPhoto"> @if (Model.HasPreviousPhoto) { if (Model.CurrentPhotoIndex == 0) { <a href="@HrefHelper.ToPhoto(Model.Title, Model.CurrentPageIndex - 1, maxPhotosOnThePage)"> <section class="navSection"> <img class="previousPhoto" src="@Url.Content("~/Content/Icons/arrows.png")" /> </section> </a> } else { <a href="@HrefHelper.ToPhoto(Model.Title, Model.CurrentPageIndex, Model.CurrentPhotoIndex - 1)">

Why isn't this AJAX code showing any output in ASP.NET?

丶灬走出姿态 提交于 2019-12-12 02:23:44
问题 <head runat="server"> <script type ="text/javascript"> function LoadXMLDoc() { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("Div1").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","ajax_info.txt",true); //this text file is in the

ASP.NET MVC AJAX onError handling

天大地大妈咪最大 提交于 2019-12-12 02:06:18
问题 I am trying to delete item from table. There is Ajax link for it. @Ajax.ActionLink("Delete", "DeleteConfirm", new { id = Model.ID }, new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "TableID", OnSuccess = "CloseDialog", OnFailure = "AlerDialog" }) It calls DeleteConfirm method from controller with POST method. I made simple controller which should do something so ActionLink should catch error and run OnFailure function (to show alert dialog). Controller: public ActionResult

AsyncFileUpload: How do I hide the max request length exceeded alert error?

与世无争的帅哥 提交于 2019-12-12 01:32:52
问题 If I upload a file that is larger than the configs max request length I get a "Server Response Error: Unknown Server Error" alert popup. It asks if I want to see the response page and if I click "OK" an application error window pops up saying "Maximum request length exceeded." I found this already... Catching "Maximum request length exceeded" I was unsuccessful at getting that to work. I also found another SO question (I can't seem to find it now) that was similar. The difference was that the

How to validate the form in this scenario

社会主义新天地 提交于 2019-12-12 01:29:51
问题 @model Contoso.MvcApplication.ViewModels.QuizCompletedViewModel <h2>Quiz 1</h2> <form method="post"> @for (int i = 0; i < Model.Questions.Count; i++) { @Html.EditorFor(model => model.Questions[i], "Questions/_MultipleChoiceAnswerView") } <div> <p style="float: left;">Question @ViewData["CurrentNumber"] of @ViewData["TotalQuestions"]</p> <input type="submit" value="Continue" style="float: right;" /> </div> </form> As you can see, I'm showing all the questions through the loop. But I really