Javascript - Pass JSON File From ASP.NET To JQuery?

Feb 27, 2012

my problem is that my company does not want to serve up the .json MIME type, so I have to use ASP.NET to fetch the JSON file from the file server. Currently I have jQuery that does a getJSON and traverses the JSON object to build certain elements of the page. Is there a way I can use ASP.NET (VB) to give the object to my jQuery script after I fetch it?

View 1 Replies


ADVERTISEMENT

Jquery - Use JSON With APS.NET?

Mar 15, 2012

I have an assigment where I must send queries to the database and the returns data. I would like to convert that data to a json and then use it with jQuery

My idea is make an array (żarrayList?) and then convert it to json.

How can i use json with asp.net vb? I'm not allowed to use a webservice yet

View 2 Replies

Jquery - Getting An XML Error Messages For JSON?

May 20, 2011

UPDATE 2: I did not mention that I do not get the error below in Chromium, but I do get it in IE8.

UPDATE 1:

Response Headers:
HTTP/1.1 200 OK
Date: Fri, 20 May 2011 15:40:23 GMT[code].....

Why does that happen and how can I stop the error message from appearing?

View 3 Replies

Jquery - JSON Key/value Pair Plus Count

Jun 22, 2011

I need to return json data from the server, which can be used on the client side and I am not sure the best way to format the json data.

So basically, What is the best way to format the json data to include:

key/value pairs so they can be looped through at clientside (loop via jquery), a count of the number of id/value pairs which can be used at clientside for other purposes (used via jquery).

View 3 Replies

Jquery :: WCF Not Deserializing JSON Input?

Feb 21, 2011

I have a WCF service defined as follows:

Imports System.ServiceModel
Imports System.ServiceModel.Web
<ServiceContract()>

[code].....

View 1 Replies

Asp.net - Dealing With Data Returned By A Web Method As JSON With JQuery?

Jan 13, 2012

[URL] Using this I have managed to use Server Side Web Methods to perform actions with AJAX.In most instances, I just need it to do stuff (save things to a database for example) so don't need to do anything with the response, but now I've come across a situation where I do, and I can't work it out!The Web Method returns a JSON object, which looks like this:

{"d":"[{"validDetails":"True","lateAlert":"","LoginResponse":"Logging in Jamie at 16:53 please wait"}]"}

This is the output shown from Firebug. I am not sure what the 's are, but bear with it...The AJAX call and attempt at outputting this response is:

$("form").on("submit", function () {
var LogonObject = new Object;
LogonObject.password = $('#password').val();

[code]....

And several other variations from info I have found on Google and SO, but it seems to treat the results variable as a string, not an array, and the output I get on the alerts is each individual character, ie;

[, {, ", v, a, l, i, d, D... etc

So I wondered if results needed to be converted to JSON again (though I don't know why) so I tried

results = $.parseJSON(data.d)

But that didn't work either.

EDIT, the code which generates the response (missing out tons of logic, but this is the important bit):

Public Class OutputObject
Public validDetails, lateAlert, LoginResponse As String 'content of JSON output'
End Class

[code].....

View 2 Replies

JQuery - Ajax - Json - Javascriptserialize - Writes Out The Contents Of A Datatable

Aug 26, 2011

I am having a heck of a time with some very simple json. I have a very basic VB.NET webform which which writes out the contents of a datatable serizlized with JavaScriptSerializer.

CODE:

On the jquery side I am doing this.

CODE:

This is returning "invalid json"

Here is the output

CODE:

View 1 Replies

Javascript - .Net Json Serialization Format?

May 16, 2012

I was hoping someone may be able to point me in the right direction in regards to the format of a Json.I've never really worked with Json's and Serialization before so it's all a little new.I need to return a Json from .Net in the following format.[[Date.UTC(2011,12,14,8), 8], [Date.UTC(2011,12,14,9), 1]]

I'm almost there but am struggling with the format of my string, as by default the string is quoted. This is what I have:

[Code]...

View 2 Replies

Javascript - Return JSON From ASP.NET .asmx?

Nov 5, 2009

I have the following test method:Imports System.Web

Imports System.Web.Services
Imports System.Web.Services.Protocols
<WebService(Namespace:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<System.Web.Script.Services.ScriptService()> _

[Code]...

Even with the ResponseFormat attribute added the response is still being returned as XML rather than JSON.

View 6 Replies

JavaScript Serialize Array To JSON?

Mar 28, 2011

I have "Form Designer" web application, in which I need to post the controls of the new form to an ASP.Net page to insert to DB, each time I create form control. I push it into two dimensional array, when user click save, this array will be serialized and sent to Server Page using Ajax.

Array string After Serialization Looks Like :
[
[

[code].....

View 2 Replies

Javascript - Create A Json Object In 2005?

Sep 8, 2009

I want to create a json object in vb.net to send the response back javascript function to do something?

View 2 Replies

Delete A Gridview Row Using Javascript Or JQuery

Dec 26, 2011

How do I use this jQuery function to remove a row.

$(document).ready(function() {
$("tr").filter(function() {
return $('td', this).length && !$('table', this).length

[Code]....

Here I have another control delete button, in delete button I will get a id to delete, here I want to pass that id as a parameter to script function ,
and I want to search hidden field contains those value and delete that row.

Private Sub btnDelete_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnDelete.Click
'some operations
ScriptManager.RegisterStartupScript(Me, GetType(String), "Deletearow", "DeleteGrid_Row(" & Me.hfSelected_GvResultsRowTocID.Value & ");", True)
End Sub

View 2 Replies

Get Data Into JavaScript And Render With JQuery?

Dec 5, 2011

So here is the situation. I am originally a PHP developer, here are my steps to render data:

PHP gather data from DataBase
PHP write data to JavaScript
JavaScript render using JQuery to HTML
HTML display to user
User Postback to PHP
PHP write back to Database with new data

Now I am using VB.NET and I need to use their paradigm with controls and what not. However I would like to render using JQuery and JavaScript. How do I get data into JavaScript when loaded in VB and get it back once user post?

[Code]...

View 2 Replies

Javascript - Change Hue Or Color Of A PNG With ASP.Net/jQuery

Jun 2, 2012

I'm working on a web page that takes multiple PNG images and merges them into one image so the user can download the flat image. I would like to add a hue or color adjustment (like color balance in photoshop) so I can adjust the different PNG image layers without having to create a separate image for each hue. Right now I'm using ASP.net/VB.net and some jQuery and the System.Drawing.Image method to merge the images. I can't seem to find any information on doing this for the web without using silverlight or flash and I do not want to use either.

View 1 Replies

Jquery - Calling A Function From Javascript

May 25, 2009

I need to find a way to call a vb.net function in my aspx page from javascript. I have a Jquery function that makes the .drop class .droppable, and whenever I drop a .draggable onto a drop target, my Jquery code successfully fires a java alert statement. All in pure javascript. What I need to do is some heavy math!

[Code]...

View 2 Replies

Jquery :: Compare Dates Javascript?

Apr 26, 2011

I need to validate different date's with some javascript(jquery).I have a textbox with, the inputmask from jquery The mask that i use is "d/m/y".Now i have set up a CustomValidator function to validate the date.I need 2 functions. One to check if the given date is greater then 18 years ago. You must be older then 18 year.ne function to check if the date is not in the future. It can only in the past.

The function are like
function OlderThen18(source, args) {
}

[code].....

View 4 Replies

Use Javascript / Jquery In Windows Applications?

Dec 2, 2011

This might be a stupid question but is it possible to use javascript/jQuery in windows applications? Im making this application in vb.net, just for personal use and im just making it to practice and to learn more about vb.net programming. I know javascript is ment for web applications but maybe there are ways to use them in windows applications aswell.

[Code]...

View 4 Replies

Javascript - JSON Array Type Resolution In ASP.Net Webservices?

Jan 6, 2011

I have worked out how to pass my custom objects into ASP.Net json webservices. Works a charm. Problem I am having is passing in straight arrays of my custom objects or alternatively passing in arrays that are parameters of my custom objects. So for example...

Public Class WebService1
Inherits System.Web.Services.WebService
<WebMethod()> _

[code]....

Fails with error: The value "System.Collections.Generic.Dictionary`2[System.String,System.Object]" is not of type "WebApplication1.WebService1+Person" and cannot be used in this generic collection. Parameter name: value

So how do I explain to ASP.net that it is infact an array of Person? note: That changing the function to as List(of Person) or ArrayList does work but given that I implement my own custom collections this is not optimal for me.

UPDATE: Ok so what I have worked out so far is that this problem is definitely associated with how the JavascriptSerializer uses the SimpleTypeResolver to resolve types. Basically if I do something like this

Public Function AddPersonList(ByVal PersonList As String) As PersonList

I can recreate the error using the following code.

Dim PersonList As PersonList = jsonSerializer.Deserialize(Of PersonList)(PList)

However when I provide my own custom type resolver along the lines of

Dim jsonSerializer As New JavaScriptSerializer(New MyCustomTypeResolver)

I can successfully create an instance of my custom list.Now I have worked out how to provide my own custom convertor in the web.config file. Along the lines of this....

<system.web.extensions>
<scripting>
<webServices>

[code]....

PSS: I have tried to use the assembly fully qualified name as specified in the docs for the SimpleTypeResolver (SimpleTypeResolver MSDN) but this throws a "Operation is not valid due to the current state of the object." exception - which is an error caused when the TypeResolver cannot resolve the name?

My problem was never passing in a List(of Object) into my webservice (I simply posed the question as such to simplify it for stackoverflow). In such a case I would be willing to completely accept using a Generic List(of) but my problem was actually that one of my custom objects implemented a property with a strong typed List(of) so for example:

Customer {CustomerID AS Guid, FirstName AS String, LastName AS String, EmailAddresses AS EmailAddressList}

which now needs to be changed to

Customer {CustomerID AS Guid, FirstName AS String, LastName AS String, EmailAddresses AS List(Of EmailAddress)}

This is admittedly not the end of the world and is probably better in the webservice context (as you have suggested) but definitely a detriment when it comes to internal application usage of my Collection properties. What this means is that once I have this property I either need to cast it to my CustomCollectionList every time I want to use some advanced feature or I need to implement another property which exposes the CustomCollectionList.

View 5 Replies

Javascript - ASP.NET JQuery Filter Listbox From Textbox Value?

Feb 3, 2012

I have a text box and a list box, my ultimate aim is to use the text box to filter the list box. The below code works however the text box is case sensitive and I need the user to be able to input any case and it filters the list box accordingly, at moment.Example

"MY SITE" = Works
"my site" = Works
"My Site" = Does not work[code]........

View 1 Replies

Javascript - JQuery Alert When Bar Code Is Scanned

May 5, 2012

I want a web page that pops up a JavaScript alert when a bar code scan is done. I don't want to tie the event to any visible control such as a textbox so thus, I won't have focus on any control to capture the scan input. Can this be done with JQuery?

View 1 Replies

Javascript - Using Jquery To Pull From Ajax Response

Jun 15, 2012

[URL] Response when viewing URL: {"Status":"OK","Message":"0","Info":"(none)"} Using JQuery how do I pull from that? I get how you do POST and sending but little lost has to how to pull from that. Do I use GET? Am I doing something like $.get("URL HERE"...?

View 3 Replies

Jquery - Delay A ASP.NET AutoPostBack So JavaScript Fires First?

Mar 2, 2010

I've got an odd situation with a text box and an autocomplete setup on my page. I'm using a JQuery based autocomplete on a text box that has AutoPostBack="True". This works perfect if I use the keyboard to select an autocomplete item, which then fires Jquery to fill in the text box, and then when I tab out of the box the AutoPostBack fires. If, however, I click on an autocomplete item, my text box loses focus first and the AutoPostBack fires before the Jquery has a chance to change the text in my text box. Is there a way to delay either the PostBack or the Jquery so that they don't fight each other? I'm thinking it may have to be the PostBack that gets changed, since the JQuery would lose it's state on the PostBack.

View 1 Replies

Jquery - Show Thumbnail From A Folder Using Javascript In Asp.net

Sep 7, 2011

I have uploaded some images using uploadify and saving the original file in "uploads" folder and thumbnails in "uploads humbs" folder now what I need is I have a div element on the main.aspx page where I need to show thumbnail image.After clicking the thumbnail I need to give a lightbox effect to it.

1.I have done this way but this is showing me the original image instead of thumbnail.So how do I point to my thumbnail.

2.When Using Lightbox effect how do I manage my two Imagess with the below code.

This is my Handler code:

Public Class UploadVB : Implements IHttpHandler
Public Sub ProcessRequest(ByVal context As HttpContext) Implements IHttpHandler.ProcessRequest

[Code].....

View 2 Replies

Pass Json Data In A Particular Format

Oct 8, 2010

I have to pass my Json data in a particular format. My app is coded in vb. The following is my code :

[Code]...

View 1 Replies

Javascript - Accessing Elements Of JSON Object Without Knowing The Key Names

Feb 25, 2011

Here's my json:

{"d":{"key1":"value1",
"key2":"value2"}}

Is there any way of accessing the keys and values (in javascript) in this array without knowing what the keys are?

The reason my json is structured like this is that the webmethod that I'm calling via jquery is returning a dictionary. If it's impossible to work with the above, what do I need to change about the way I'm returning the data?

Here's an outline of my webmethod:

<WebMethod()> _
Public Function Foo(ByVal Input As String) As Dictionary(Of String, String)
Dim Results As New Dictionary(Of String, String)

[Code]....

View 2 Replies

Javascript - Set JQuery Toggle To Be Open On ASP.Net Gridview Postback

May 12, 2011

I have a jQuery 'toggle' function on a table that I am using in conjunction with an asp.net gridview. I have pagination on my gridview and when I click on the next page, it posts back and therefore closes the Toggle/Table - I need a way of keeping it open. I have had a similar issue in the past with the Accordion function but resolved it via this method

<asp:HiddenField ID="hidAccordionIndex" runat="server" Value="0" />
<script language="javascript" type="text/javascript">
$(function () {

[Code].....

View 1 Replies

Javascript - Show Modal Dialog Implementation Using JQuery

Apr 22, 2011

I need to open a page as a Modal Dialog using Jquery .For Example: I have 2 pages say, Parent.aspx & Child.aspx, I need to open child.aspx in a modal dialog using JQuery when i click on a button/link in the parent.aspx. Also Postback can happen in the parent and child pages.

View 5 Replies

Jquery - Javascript Posting To .Net Page Multiple Times?

Apr 15, 2011

Upon a javascript button click, I'm using jquery to post to a url:

$(".optionClick").click(function () {
var caseOption = $(this).attr('title');
$.post("../tracking/RecordClick.aspx?page=gallery&item=" + caseOption);
});

On the page being called, I'm using the following vb.net code to retrieve the querystring variables and write them to a database:Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

[Code]...

Each of the javascript blocks above worked locally as intended but failed in the same manner with multiple DB writes and Firebug "Aborted" status.If I call the url+querystring directly via the browser, everything works as expected. (Edit) Also tried using the full path url in the code above - no improvement.

View 3 Replies

JQuery Error On JavaScript Document Null Or Undefined

Oct 10, 2011

I am recieving the following error when trying to execte the java script listed below in the page load event of an aspx web page.

Microsoft JScript runtime error: Unable to get value of the property 'document': object is null or undefined

Dim scriptString As String = ("<script>javascript: window.opener.document.forms(0).submit(); </script>")
If Not Page.ClientScript.IsClientScriptBlockRegistered(scriptString) Then
Page.ClientScript.RegisterClientScriptBlock(Me.[GetType](), "script", scriptString)
End If
I am trying to produce a postback.

View 1 Replies

Javascript - Creating A Web Server Control To Mimic Jquery Autocomplete API?

May 2, 2012

I am attempting to create a ASP .Net (VB.Net) custom control for an auto-complete drop down that uses jQuery auto-complete.The basic flow is the consumer of the control will set some properties (such as the data source) which will then be injected as javascript to initialize the autocomplete.There are a lot of pieces involved so i may have missed posting some of the code, please comment if you think something is missing and i will add it.the consumer's code behind (PreInit event):

myDropDown.DataCallback = "testFunc";

the DataCallback property in the control:

Public Property DataCallback As String

the options object creation and javascript injection in the control code behind (PreRender event):

Dim _serializer As New JavaScriptSerializer()
Dim optionsObject As New Dictionary(Of String, Object)
optionsObject.Add("source", DataCallback)

[code]....

when i debug into the initialize function, i see options has one property, source, with the string "testFunc" as it's value. what i need is for source's value to be testFunc (not as a string) so it can be executed as a callback in autocomplete instead of autocomplete thinking it is a URL.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved