Skip to main content

Posts

Showing posts with the label asp.net

How to format a JSON date?

I'm taking my first crack at Ajax with jQuery. I'm getting my data onto my page, but I'm having some trouble with the JSON data that is returned for Date data types. Basically, I'm getting a string back that looks like this:

Jquery AJAX with ASP.NET WebMethod Returning Entire Page

I'm doing some simple tests (in preparation for a larger project) to call an ASP.NET WebMethod using JQuery AJAX. In my example, my WebMethod returns a simple string. However, when I attempt to call it using JQuery, I get the entire HTML page content returned instead of just my string. What am I missing?

Detecting Unsaved Changes using JavaScript

I have a requirement to implement an "Unsaved Changes" prompt in an ASP .Net application. If a user modifies controls on a web form, and attempts to navigate away before saving, a prompt should appear warning them that they have unsaved changes, and give them the option to cancel and stay on the current page. The prompt should not display if the user hasn't touched any of the controls.

$("#form”).attr("method”, "post”) is In java Script ASP.NET

I have a Grid view where I have a hyper link button which displays ID, by clicking on it I make a Ajax call to the server and get the specific URL to navigate against of the ID. After the Ajax call complete I call the following Codes to open the respective page in New Tab/Window. function RedirectPageUrl(rqstID) { $("#formMain").attr("action", rqstID); $("#formMain").attr("method", "post"); $("#formMain").attr('target', '_blank'); $("#formMain").submit(); return false; } Here my problem is after clicking on the First hyperlink button things are working perfectly but then onwards whenever I click on any control (say Button)the previous opened form opens up. How to get rid of it any idea??

asp.net unable to locate a resource file

Im attempting to utilize some custom script and css files within an asp page. In Visual Studio 2010 I am not getting any warnings or errors as to the status of these files, but when I attempt to run the page, and I open the javascript console I get the error: Failed to load resource: the server responded with a status of 404 (Not Found) Here's how I am attempting to load the files in my ascx file: <script type="text/javascript" src="scripts/jquery.js"></script> <script type="text/javascript" src="scripts/jquery.scripts.js"></script> <script type="text/javascript" src="scripts/jquery.alerts.js"></script> <link href="styles/jquery.alerts.css" rel="stylesheet"/> Anyone know whats going on here, why the browser can't locate the files but visual studio can?

jQuery Select list, selected text value rather than the value

building on my last question jQuery getting values from multiple selects together I have the select list like: <select name="access" class="change" id="staff_off" runat="server"> <option value="8192">Off</option> <option value="8192">On</option> </select> And I basically want to add or subtract the value of the options if it's off, subtract if it's on add it. It's going to be stored in a cookie (it uses bitwise) The jquery I have is: <script> $(document).ready(function(){ var currentAccess = $.cookie("access"); }) $("select").change(function () { var currentText = $(this).text() var value = $(this).val() $.cookie("access", value, { expires: 24 }); alert(currentText); alert( $.cookie("access")

Firefox 10 - unclickable buttons?

Has anyone seen this behavior: I have a couple of HTML buttons used to drive a content rotator: <div id="rotatorControls" class="rotatorControls" runat="server"> <input name="previous" id="previous" type="button" value="&laquo;" /> &nbsp; <input name="next" id="next" type="button" value="&raquo;" /> </div> The buttons are activated with a little jQuery: $(document).ready(function() { mcarousel = $("#carouseldiv").msCarousel({ boxClass: 'div.box', height: 100, width: 450 }).data("msCarousel"); //add click event $("#next").click(function() { //calling next method mcarousel.next(); }); $("#previous").click(function() { //calling previous method mcarousel.pre

retrieve serialized java.util.Arraylist in asp.net client (SUID doesn"t match)

I am trying to send persisted objects from a java webservice to the ASP.Net client. Both sides have the object-classes, with the same SerialUID's. Classes without (Array)Lists pose no problem, but when I want to send objects including ArrayLists, the expected SUID is incorrect: [java.io.InvalidClassException] = {"the class does not match the class of the persisted object for cl = java.util.ArrayList : __SUID = 8683452581122892189, getSUID(cl) = 9195509126275115639"} Serialization is implemented using binary formatting, not XML because with XML we have circular references between the persisted objects. Using J# at client side, by expecting a java.util.ArrayList instead of an IList or a System.collections.ArrayList doesn't change anything. Any help would be greatly appreciated!

Saving Div Content As Image On Server

I have been learning a bit of jQuery and .Net in VB. I have created a product customize tool of sorts that basically layers up divs and add's text, images etc on top of a tshirt. I'm stuck on an important stage! I need to be able to convert the content of the div that wraps all these divs of text and images to one flat image taking into account any CSS that has been applied to it also. I have heard of things that I could use to screen capture the content of a browser on the server which could be possible for low res thumbs etc, but it sounds a little troublesome! and it would really be nice to create an image of high res. I have also heard to converting the html to html5 canvas then writing that out... but looks too complicated for me to fathom and browser support is an issue. Is this possible in .NET? Perhaps something with javascript could be done? Any help or guidance in the correct direction would be appreciated! EDIT: I'm thinking perhaps I could do

jQuery watermark plugin disappearing

I am in search for a good jQuery watermark plugin that work with ASP.NET and found here and downloaded it and included in the head portion <script src="js/jquery.watermark.min.js" type="text/javascript"></script> I have login and signup on same page and referencing them as: <script type="text/javascript"> $(function () { $("#<%= (Login1.FindControl("UserName")).ClientID %>").watermark("Enter your Username"); $("#<%= (Login1.FindControl("Password")).ClientID %>").watermark("Enter your Password"); $("#<%= (CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("UserName")).ClientID %>").watermark("Enter your Username"); $("#<%= (CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Password")).ClientID %>").watermark(

Jquery ajax functions stopped working

Ive been working on some jquery within a a page. Now all of a sudden the post functions seem to have stopped working? function deleteRow(OrderNo, LineNo) { alert(OrderNo + ";" + LineNo); $.ajax({ type: "POST", url: "Ajax.aspx/DeleteRow", data: '{' + 'OrderNo:"' + OrderNo + '",' + 'LineNo:"' + LineNo + '"' + '}', contentType: "application/json; charset=utf-8", dataType: "json", success: function (msg) { //$("#item").val(msg); var data = jQuery.parseJSON(msg); if (!data.error) { $('#' + LineNo).remove(); } else { alert("Error" + " " + data.error); } }, error: function (msg) { alert('Failure: ' + msg); } }); }

Disable jquery in masterpage for a specific content page?

I have this code that warns the user about unsaved changes and it's in the MasterPage of the site I'm working on. I have a search page that doesn't allow the user to save anything and it triggers the unsaved changes warning. Is there a way to disable the code for this one content page? var _changesMade = false; $(document).ready(function () { $('form').bind($.browser.msie ? 'propertychange' : 'change', function () { _changesMade = true; }); $(window).bind('beforeunload', function () { if (_changesMade) return 'There are unsaved changes which will be lost if you continue.'; }); });

JavaScript method not working in ASP.NET User Control

I asked a question before about a JavaScript code you can see it here : How can I scroll down to a multiline TextBox's bottom line, Javascript's scrollIntoView is not working for this . Well, it was solved and the accepted answer was working. Afterwards I had to move the code part you can see in that question to a User Control which finally looked like this : <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="LiveChatPart.ascx.cs" Inherits="BeyzamComArayuz.LiveChatUserControl.LiveChatPart" %> <%@ Register src="/LiveChatUserControl/GenelOdaFlashPart.ascx" tagname="GenelOdaFlash" tagprefix="gOF" %> <script language="javascript" type="text/javascript"> function buttonClicked() { // var el = document.getElementById("TxtBxOdaMesajlari"); var textBox = $get("TxtBxOdaMesajlari"); textBox.scrollTop = textBox.scrollHeigh

Javascript redirect causing a security exception in asp.net 4.0 forms

As part of my current project I have had to make a page take on two functions due to some functional limitations. At present the two views are turned on and off based on a query string value. The page is loaded from an menu that is similar to that of the original ipods and as such uses Javascript to kick things off. The problem is when I select my url (along with the query string value) I get a potential security risk error. I believe that its down to security not allowing Javascript to redirect with the query string, however I am at a loss as to how we solve this one. The error reads -- 'A potentially dangerous Request.Path value was detected from the client (?).' I know that I can turn the security off on the page, however this is not an option in this instance. Any ideas would be greatly recieved. Thanks in advance