asp.net-ajax

How to access textbox, label inside update panel from code behind using asp.net web forms

早过忘川 提交于 2019-12-10 14:38:25
问题 I have a few controls defined inside an update panel which are bound to repeater control. I need to hide and show the user name and country based on anonymous fields, but the problem is that I'm not able to access the controls defined inside update panel programmatically. How can I access these controls, I looked on the net also but couldn't find many references Below is the code from aspx page and .cs page <asp:UpdatePanel ID="updPnlComments" runat="server"> <ContentTemplate> <table border=

how can i call web api Controller from ajax

丶灬走出姿态 提交于 2019-12-10 14:23:42
问题 I am a beginner of ASP MVC with web api. By using below codes I tried to call a function which is written at the controller. For checking I used breakpoint so the control could not go to the controller so that I can not track actually what is going on. The given code explains how to pass username and password to the controller: <script type="text/javascript"> function Login() { var Login = {}; Login.username = document.getElementById("txtUserName").value; Login.password = document

The name 'ScriptManager' does not exist in the current context

旧街凉风 提交于 2019-12-10 14:07:34
问题 I copied some code to solve a problem with running JavaScript after an AJAX postback in ASP.Net. Unfortunately the new code gave me the following error when doing a build: The name 'ScriptManager' does not exist in the current context Now I've used the ScriptManager before, so why would it be giving me problems now? Isn't it available on all ASP.Net pages? I have a script manager on my master page after all... 回答1: I suppose there could be a number of things wrong that would generate this

Forcing RadComboBox drop down direction

拥有回忆 提交于 2019-12-10 13:51:55
问题 Users are desiring that the drop down window of a RadComboBox go up instead of down, regardless of where on the screen they are. Not sure why, but how would you implement this? Note: I have a RadComboBox with a custom template, not the default implementation. Thanks. 回答1: You have to disable screen boundary detection. Then you can set the expand direction to "Up", e.g: <telerik:RadComboBox runat="server" EnableScreenBoundaryDetection="false" ExpandDirection="Up" /> Update: it seems this also

Should I use Ajax Timer?

谁都会走 提交于 2019-12-10 12:29:27
问题 I want to have a stopwatch on the site, which displays running time on the label without reloading a page. Is it possible to do this on client side? Should I use Ajax timer or smth else from .net? Website is in C#. Some links or demos would be really helpful ! Thanks ! 回答1: You can do this with basic JavaScript using setTimeout: var totalSeconds = 0 function stopwatch() { // increment the seconds totalSeconds++; // display the seconds to the user document.getElementById("<%=myLabel.ClientID%>

jQuery AJAX not sending data

无人久伴 提交于 2019-12-10 11:25:01
问题 This is my jQuery / JS code: var selectedMonths = []; var selectedLocations = []; var selectedEvents = []; $("#filter").click(function () { $('#months li').each(function () { if ($(this).find('input[type=checkbox]').is(':checked')) { selectedMonths.push($(this).find('a').attr('data-value')); } }); $('#locations li').each(function () { if ($(this).find('input[type=checkbox]').is(':checked')) { selectedLocations.push($(this).find('a').attr('data-value')); } }); $('#events li').each(function ()

ModalPopupExtender and z-index

家住魔仙堡 提交于 2019-12-10 11:08:21
问题 How can I change ASP.NETAJAX ModalPopupExtender z-index. By default it is 100001. Thanks. 回答1: I use this function: function ShowModalPopup(modalPopupId, zIndex) { try { if (modalPopupId == null) throw new Error(0, 'Incorrect value of param modalPopupId!'); var modalPopupBehavior = $find(modalPopupId); if (modalPopupBehavior == null) throw new Error(0, 'Not found modal popup ' + modalPopupId + '!'); zIndex = typeof (zIndex) != 'undefined' ? zIndex : null; if (zIndex != null) {

ASP.NET web service erroneously returns XML instead of JSON

萝らか妹 提交于 2019-12-10 10:16:49
问题 I'm attempting to use an ASMX web service from javascript using jQuery. It works fine when I ask for XML, but I want to make use of .net's JSON serialization functionality; (it's also starting to bug me that this isn't working) The code for the web service: using System; using System.Web; using System.Web.Services; using System.Web.Services.Protocols; using System.Web.Script.Services; [WebService()] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] [ScriptService] public class

HTTP Handler cannot find axd file in nested web application folder: Telerik RadScriptManager cannot find WebResource.axd in ~/admin/ folder

老子叫甜甜 提交于 2019-12-10 10:15:37
问题 We have a web application with 2 web.config files. I'm using the telerik:RadScriptManager control within an ASP.NET page. There is web resource file (WebResource.axd) that this control needs access to for it's ScriptReferences. I think this .axd file contains the JavaScript files for Telerik's controls. All of our Rad Controls are implemented in a separate web application (.csproj) project called "admin". The root web application project (.csproj) has a folder called "admin" where all of the

Error handling, Session expire strategy in ajax asp.net app

房东的猫 提交于 2019-12-10 10:12:56
问题 Does anybody have any strategy or ideas for overall handling of errors and session expiration in a big ajaxy application? In a traditional web application when everything was a post or get, it's easy to handle errors and session expiration and present friendly messages to users. Not so much with modern ajaxy web applications. My web app uses ASP.Net Ajax update panels and WCF calls from various pages throughout. Any one of those ajax calls could return an error or the user's session could be