asp.net-ajax

Run a method in controller according to datepicker value

妖精的绣舞 提交于 2019-12-11 05:03:52
问题 I want run the method Index in the Home Controller according to the date selected in datepicker, Here is my View code: <input type="text" name="date" class="datepicker" id="calendar" /> $("#calendar").datepicker({ dateFormat: 'dd-mm-yy', onSelect: function (date, instance) { $.ajax({ type: "GET", url: '@Url.Action("Index","Home")/' + date, success: function (data) { if (data.success) { alert(date) } } }) } }).datepicker("setDate", new Date()); I want when I choose a date in my datepicker run

Calculate month different using radMonthYearPicker

最后都变了- 提交于 2019-12-11 04:34:06
问题 I have 2 radMonthYearPicker(1 is for start Date another 1 is for end Date) I want to calculate the month different between this 2 date. for my start Date, I set my month as dec and year 2012. for my end Date, I set my month as dec and year 2013 Base on this 2 RadMonthYearPicker, the month apart should be 12 month The only code I can find out is RadMonthYearPicker.selectedDate P.S. I was not allow to upload image file due to lack of repulation point 回答1: int monthsApart = 12 * (startDate.Year

How to Pass Image File and Form Data From Ajax to MVC Controller

巧了我就是萌 提交于 2019-12-11 04:17:11
问题 I have a form with Image and another fileds, I want to send data with image in controller. <form id="first-form" method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-md-9"> <div class="row"> <div class="col-sm-6 form-group"> @Html.Label(@RegisterResource.Name, new { @class = "control-label" }) <div class="field-input"> @Html.TextBox("Name", null, new { placeholder = @RegisterResource.Name, autofocus = "autofocus", @class = "input-text" }) @Html.ValidationMessage(

Dynamically add CalendarExtender to Textbox subclass server control?

心不动则不痛 提交于 2019-12-11 03:48:32
问题 I'm trying to create a server control, which inherits from TextBox, that will automatically have a CalendarExtender attached to it. Is it possible to do this, or does my new control need to inherit from CompositeControl instead? I've tried the former, but I'm not clear during which part of the control lifecycle I should create the new instance of the CalendarExtender, and what controls collection I should add it to. I don't seem to be able to add it to the Page or Form's controls collection,

Execute a javascript function when textbox is populated in jQuery?

安稳与你 提交于 2019-12-11 03:38:39
问题 How do I execute a function in JavaScript when a text box is populated with text? The text box with be hidden from the user. It will be populated by a USB magnetic card swiper. Pseudo code: <script language="javascript" type="text/javascript"> function MyFunction() { //execute this function when MyTxtBox is populated } </script> <asp:TextBox id="MyTxtBox" runat="server" Visible="false" /> 回答1: Seems like you're doing this when the page loads. If you are, this would work. $(document).ready

ASP.NET Ajax

时间秒杀一切 提交于 2019-12-11 03:29:46
问题 I have a custom control that has the following prototype. Type.registerNamespace('Demo'); Demo.CustomTextBox = function(element) { Demo.CustomTextBox.initializeBase(this, [element]); } Demo.CustomTextBox.prototype = { initialize: function() { Demo.CustomTextBox.callBaseMethod(this, 'initialize'); this._onblurHandler = Function.createDelegate(this, this._onBlur); $addHandlers(this.get_element(), { 'blur': this._onBlur }, this); }, dispose: function() { $clearHandlers(this.get_element()); Demo

ASP page scrolls to top on UpdatePanel update

别等时光非礼了梦想. 提交于 2019-12-11 03:12:00
问题 I am having a problem where I have an UpdatePanel that uses a timer to trigger to update an ASP graph with new points (essentially the guide at http://www.4guysfromrolla.com/articles/121609-1.aspx under "Creating Real Time Charts"). I'm having a problem where whenever the timer ticks, the entire page scrolls to the top. How can I maintain the scroll position in the page when the timer ticks? I've tried the instructions at http://www.4guysfromrolla.com/articles/111704-1.aspx and several other

Calling a Winform hosted WCF service from javascript

拟墨画扇 提交于 2019-12-11 01:55:32
问题 I have a Winform hosted WCF service with Ajax Web endpoint. I also have an ASP.NET project separately, with ScriptManager component on the page. My question is, should that work if I make service calls to my Winform hosted service from the client side of ASP.NET app using javascript? My ASP.NET Default page looks like this: <script type="text/javascript"> function Button1_onclick() { // ????How to call a service method????? } </script> <asp:ScriptManager ID="ScriptManager1" runat="server">

Access to session when making ajax call to Asp.net MVC action

两盒软妹~` 提交于 2019-12-11 01:08:19
问题 i have a controller action being called using an ajax request, but when i tried to access session (HttpContext.Session["key"]), i dont have any of my session keys populated. How can i have access to my session keys when i make a call using ajax. 回答1: The available Session in the controller is the HttpSessionStateBase. You can access it using either Session[param] or base.Session[param] if your controller inherits from Controller. But this may be useless with Ajax if you have it set cookieless

Did Client Templates in ASP.NET AJAX 4.0 get dropped entirely, in favor of the jQuery Templates plug-in?

橙三吉。 提交于 2019-12-11 00:26:05
问题 I think that Microsoft dropped client templates from the AJAX Toolkit in favor of jQuery Templates plug-in. I'm trying to find full documentation on this and except for some "will do" blog posts such as this one I am unable to find anything except @#$%-loads of bogus, obsolete documentation and magazine articles from the Preview / Beta days of ASP.NET AJAX 4.0. Can anyone please confirm that the ASP.NET AJAX 4.0 Client Templates feature is, in fact, jQuery Templates , officially, and that