Is it possible to link AJAX autocomplete to server-side event handler? - autocomplete

I am developing an ASP.NET Web Forms application in C#.
In my product reservation process I am using the ASP.NET AJAX autocomplete extender to retrieve serial codes of the products based on what the users digit.
Once a serial is selected I would like to automatically fill in also the TextBoxes for ProductName and ProductPrice to be retrieved from a database. That can be easily done on server-side by calling an event handler.
However it looks like there are no server-side events fired by the AJAX autocomplete extender. I found some client-side event but I have no clue on how to call a server-side function from Javascript.
I was suggested to use a new Javascript framework (Node.js) that interacts directly with the database but I have no experience with it.
Anybody can help? Thanks

I have implemented search auto complete using jquery in asp.net application.Its prety much easy to implement and its performance is also great.You can link server side event handler too.
Complete detail is given here
http://docs.jquery.com/Plugins/autocomplete

Related

General question about SmartSheet API and creating a user interface

My company keeps individual employee schedules. Each employee manages their own schedule. Admin,supervisors and project manager have to go to each sheet and look for the information.
I need to create a system that allows someone to select a date range and skill set then produce a sheet with the information that matches the criteria. I have installed the Python API and worked through a few tutorials.
Now I need to know how to make command buttons, date pickers . . .
A quick read of my search results indicates that this is not part of the Smartsheet API!
Is there a way to do this through the SmartSheet API? Or how would you approach this?
The Smartsheet API enables you to programmatically access data in Smartsheet (i.e., create, read, update, delete data in Smartsheet). This is true for all APIs -- they simply provide a means for you to programmatically access data. You'll need to build the web app's user interface (UI) yourself by using HTML, CSS, JavaScript, etc.
Alternatively -- instead of building a custom web application like you've described -- I'd suggest that you look into the possibility of creating Smartsheet Reports that can provide the data you've described. You can create Smartsheet Reports via the Smartsheet UI -- so you wouldn't need to do any programming at all.

Populating new form data from REST api

I've come from a background of ASP.Net MVC where when the user wants to create a new entity the server returns values to populate drop down lists(for example).
Now I'm doing a UI that is invoking a REST Api. I have my urls for creating/retrieving etc but this is purely for actual resources. How would the REST be defined to get data to populate the create form.
For example:
a user wants to create a new order. They go to the 'create order' screen and need to select their payment method. They have 3 payment methods (card, paypal, amazon) but the logic on the server side knows that amazon cannot be accepted on this order. How would I go about letting the UI know what can be populated in the drop down list using REST?
I can't seem to get this to fit into REST principles but then I don't want the user to submit amazon and then the server return a Bad Request, just seems bad implementation.
Thanks

is using MVC and JSON a possible DDOS risk

Lets say im using an mvc application and either a create or getDetails function is called in AJAX, to help with page load times.
Someone could easily look through the DOM there and get the URL of where you do your JSON request.
that person could then easily write a little javascript snippet that calls that request 500 times per second and DDoS your site.
Seen as you cannot hide your AJAX / JSON requests from the DOM, is there any way to avoid this?
Using AJAX is not any more or less dangerous than not using it. That person could easily write little javascript snippet that sends 500 requests per second to a usual web page. That would make the same DDOS effect. You need a different approach to protect your website against DDOS attacks. IP base rate limiting is a fine method of doing that.

Is there a quick way send post requests?

i want to test a small php script i wrote, which accepts POST requests..
but is there a way to test it without writing a html form.
Im trying to do this using simple rest client chrome extension. But I'm not sure how to do POST request in it.
By using Advanced REST Client, you can send a POST request in which the data can be stored as form data (probably the simplest).
Just click the second Form tab when entering the application, and you can specify key-value pairs.
Here is an image of the application.
I use a very nice Chrome extension for this: REST client or similar. Look in the chrome market, is plenty of tools.

ASP.net MVC removing repeated data calls

Ive got a asp.net mvc site that works with ASP.net Authentication. I have a UserInformation table which stores extra information on each user aswell. On pretty much every page i am calling to the database to pull the UserInformation record for the current user at least once.
Im thinking all these repeated data calls for the same information has to be overkill. Is there anyway i can cut these down? Caching? Storing the userinformation record for future use etc etc?
Im sure im not the first person to come across this issue, so i didnt want to reinvent the wheel.
Thanks in advance
You could use a custom IIdentity and IPrincipal. Here's a nice article describing how to achieve this (the interesting part is happening in the btnAuthenticate_Click method which in an ASP.NE MVC application would be the authenticate controller action, here is emitted the authentication ticket with custom data). In this example the idea is that the authentication ticket is manually created and the userData property is used to store additional information. This might not be appropriate for your case if you have lots of data because this is stored in a cookie. But instead of using the userData you could store it somewhere else like Session or Cache. You could also write a custom [Authorize] attribute to deal with the custom principal (the part that corresponds to the Application_AuthenticateRequest method in the article should go in this custom authorization filter in order to reconstruct the user back).