473,402 Members | 2,053 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Pass data from the JavaScript Object to the ASP.NET Ajax Enabled Server Control code

Frinavale
9,735 Expert Mod 8TB
I've created a few ASP.NET Ajax Enable Server controls.

There are 2 components to these controls: a server side Object that deals with the server side stuffs, and a client side Object that deals with the client side stuff.

My controls are pretty nifty and quite useful but I keep coming back come back to the same question:

How do I pass data from the JavaScript Object to the Server code?

Up 'til now I've been using HiddenFields in order to accomplish my needs but I find this cumbersome, bulky, rather nasty looking and feeling...there has to be a better way!

ASP.NET is smart enough to take the data from the server code and pass it into the JavaScript Object when it is loaded in the browser.

Why can't it take the data from the client code (the JavaScript Object) and pass it into the Server Object when it is loaded on the server?

Does anyone know how to do this?

Or even have an idea of what I should be googling for because everything I find on these controls doesn't cover how to pass information from the JavaScript Object to the Server Object (they're usually very basic, simple articles/tutorials and I'm starting to wonder if anyone's even attempted to do this)

I'm starting to look into JSON but I have no idea how I'm going to send the JSON Object to the server...or how to retrieve and this Object once it gets there...

Thanks,

-Frinny
May 27 '09 #1
3 5438
Dormilich
8,658 Expert Mod 8TB
How do I pass data from the JavaScript Object to the Server code?
the magic word is "serialization". (I know of JSON and WDDX, but there may be more)

Why can't it take the data from the client code (the JavaScript Object) and pass it into the Server Object when it is loaded on the server?
my guess is that this was not intended from the beginning. (despite that you need a new request for that)

I'm starting to look into JSON but I have no idea how I'm going to send the JSON Object to the server...or how to retrieve and this Object once it gets there...
the crucial point is that you need a new http request for that (be it AJAX or a (re)load). which way to go probably depends on what that JS object is supposed to do in ASP.NET
May 27 '09 #2
Hi,
I guess you found a solution already but for those of you who still having problems sending data from the client to the server: you can use ASP.NET Ajax and pass a JavaScript object to the server

Check this post: http://ajaxme.blogspot.com/2010/10/p...to-server.html

Eran Hefer.
Oct 25 '10 #3
Frinavale
9,735 Expert Mod 8TB
It's been a while since I've worked with any Server controls, and even though your post isn't related to server controls, it was insightful (a good refresher). It may have helped your blog if you explained what PageMethods is.

The Extreme ASP.NET:Client-Side Web Service Calls with AJAX Extensions article explains the topic quite thoroughly.

I am not prepared to expose any web methods in the project that I was working with...but this is a good idea for future projects. So long as the proper security is implemented around the web-methods to prevent unwanted execution from occurring.

-Frinny
Oct 25 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: HockeyFan | last post by:
We have an update panel that has a gridview with checkboxes and other items in each row. We went to the RowCreated event in the codebehind, to set an attribute on a checkbox in each row, to...
2
by: CrystalMikeMD | last post by:
Greetings, I've been at this problem for some time now and have decided to seek out some help. Essentially, this is what I have. A basic ASP.NET 2.0 page. On this page is the standard...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.