asp.net-ajax

window.open with target “_blank” in Chrome

爱⌒轻易说出口 提交于 2019-11-26 23:20:16
问题 I have a small javascript function which opens an url in a new tab: function RedirectToPage(status) { var url = 'ObjectEditor.aspx?Status=' + status; window.open(url , '_blank'); } This always works when called client-side by clicking a button, even in chrome. But in Chrome it won't work when it's called from server-side(!) by using ScriptManager.RegisterClientScriptBlock() In Firefox and IE it opens the url in a new tab, but chrome opens the url in a new window. What could be a workaround to

How to download a file through ajax request in asp.net MVC 4

℡╲_俬逩灬. 提交于 2019-11-26 23:04:11
问题 Below is my code : ActionResult DownloadAttachment(student st) { var file = db.EmailAttachmentReceived.FirstOrDefault(x => x.LisaId == st.Lisaid); byte[] fileBytes = System.IO.File.ReadAllBytes(file.Filepath); return File(fileBytes, System.Net.Mime.MediaTypeNames.Application.Octet, file.Filename); } This is the script which i'm using $(function () { $("#DownloadAttachment").click(function () { $.ajax({ url: '@Url.Action("DownloadAttachment", "PostDetail")', contentType: 'application/json;

how to submit query to .aspx page in python

眉间皱痕 提交于 2019-11-26 22:15:58
问题 I need to scrape query results from an .aspx web page. http://legistar.council.nyc.gov/Legislation.aspx The url is static, so how do I submit a query to this page and get the results? Assume we need to select "all years" and "all types" from the respective dropdown menus. Somebody out there must know how to do this. 回答1: As an overview, you will need to perform four main tasks: to submit request(s) to the web site, to retrieve the response(s) from the site to parse these responses to have

A potentially dangerous Request.QueryString value was detected from the client when sending html markup from jquery post call to asp.net page

别来无恙 提交于 2019-11-26 21:27:16
问题 I m making an ajax call using jQuery to an ASP.NET page which acts as my ajax server page to save the data which i am sending to it in the query string. In the ASP.NET page when i am trying to read the querystring i am getting this error: A potentially dangerous Request.QueryString value was detected from the client... I have set the ValidateRequest="false" in my page. Dont want to set it for all the pages. So did it in page level instead of config level: var content = "<h3>Sample header</h3>

Image.FromStream(PostedFile.InputStream) Fails. (Parameter is not valid.) (AsyncFileUpload))

痴心易碎 提交于 2019-11-26 21:24:26
问题 I'm using an AsyncFileUpload (AJAX Toolkit) to upload images. I have a Button which handle the image resizing. This have worked fine for some time, but not anymore... protected void BtnUploadImage_Click(object sender, EventArgs e) { var imageFileNameRegEx = new Regex(@"(.*?)\.(jpg|jpeg|png|gif)$", RegexOptions.IgnoreCase); if (!AsyncFileUpload1.HasFile || !imageFileNameRegEx.IsMatch(AsyncFileUpload1.FileName)) { AsyncFileUpload1.FailedValidation = true; ErrorLabel.Visible = true; return; }

Deserializing JSON objects as List<type> not working with asmx service

旧巷老猫 提交于 2019-11-26 20:24:09
问题 I am having trouble deserializing my JSON string. I have a class of type person with public properties for sequence number of type int, first name, and last name. I want to pass an array of these objects in JSON format and have them deserialized as a list so I can loop through them on the server, but ASP.NET says something about not being supported to be deserialized as an array. I have validated the JSON I am producing, and it is valid. Is there something special about the JSON that ASP.NET

How to have a javascript callback executed after an update panel postback?

耗尽温柔 提交于 2019-11-26 19:37:48
I'm using a jQuery tip plugin to show help tips when the user hovers certain elements of the page. I need to register the plugin events after the page is loaded using css selectors. The problem is I'm using an ASP.NET Update Panel and after the first postback, the tips stop working because the update panel replaces the page content but doesn't rebind the javascript events. I need a way to execute a javascript callback after the Update Panel refreshes its content, so I can rebind the javascript events to have the tips working again. Is there any way to do this? Russ Cam Instead of putting your

Ajax Pagination in PagedList.MVC using partial Page

有些话、适合烂在心里 提交于 2019-11-26 19:25:11
问题 PagedList.Mvc is working fine if I do not use partial page but when I use partial page with ajax to load the grid then there is problem in pagination.and I ended with the support from TroyGoode https://github.com/TroyGoode/PagedList/issues/26#issuecomment-6471793, But link provided for the support is not working. Right now, I have used like this @Html.PagedListPager((IPagedList)Model.MovieInforamtions, page => Url.Action("GetMovieDatabase", new { page })) , which loads the page but I need to

Rebinding events in jQuery after Ajax update (updatepanel)

怎甘沉沦 提交于 2019-11-26 19:21:38
I have several input and option elements on my page, each (well almost) have an event attached to update some text on the page once they change. I use jQuery which is really really cool :) I also use Microsofts Ajax framework, utilizing the UpdatePanel. The reason why I do that is that certain elements are created on the page based on some server-side logic. I don't really want to explain why I use the UpdatePanel - even if it could (it can with quite some effort) be rewritten to use only jQuery I still want that UpdatePanel. You probably guessed it - once I have a postback on the UpdatePanel

Cross domain ajax request

半城伤御伤魂 提交于 2019-11-26 18:56:55
I want to get the html respond page from the cross domain url. for this I am using the ajax request as, $.ajax({ type: 'GET', url: "http://wcidevapps.com/salescentral/idisk/0001000383/iDisk", dataType: "jsonp", success: function (response) { $(response).find('li a').each(function () { listHref.push($(this).attr('href')); }); } }); But after requesting it doesn't respond with any result back. Abhisek Das <script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script> <script type="text/javascript"> function NameAFunctionName() { $.ajax({ url: 'http://wcidevapps.com/salescentral/idisk