I've seen multiple websites on the web where they allow you to manipulate data. (i.e. Insert records, delete records, edit records).
The cool thing I've noticed is that when you click remove button, the item removes instantly from the grid. and then it asynchronously goes to a database and removes record from there without bothering a user.
For example in a regular asp.net application if you're using gridview you need to wait until database operation is complete, because gridview is a databound control. If you use update panel you still see item in grid until DataBind event fires again.
Question: is there any js/.net library that will allow me to add such a functionality to the project out of the box?
Maybe you want to use WebMethod on server side + Ajax calls on client side (using jQuery for example).
You can you Client Side Grid Like JQGrid. http://www.trirand.com/blog/jqgrid/jqgrid.html. For loading and editing data you can use Web method or web Services. You can also use ASP.net MVC .
Yes you can do.You have web method that read your data from your source such as database.
You can call this method using Ajax and you can bind ajax response to gridview
Here is example Link
Related
I have repeater control in which i am binding data from sql server database, Now i have number of records showing on my page but i want that i can filter my records according to dropdown selected. I need 4-5 dropdowns control thats depend on my need and i don't want my page to refresh while filtering.
Below is the example, this website using checkboxes too but i need only dropdowns...
http://www.phonearena.com/phones/full#/phones/full/
Give me any idea how to start, i think ajax is the thing i need. Suggest some examples if you have.
Ajax is the right solution.
Personally i suggest you jquerytemplate and ajax call few row code to achive your goal you may find more info here Load JSON data using the dropdown menu and refresh the div area with the new results in a web site
It is a good point to start and you can make more stuff with this logic :) really simple and fluid code :)
I would suggest you to use a client-side framework (so in JavaScript) like AngularJS, BackboneJS or KnockoutJS. They all provide ways to work with collections in JavaScript (like filtering in this case). You won't need Ajax excepted for the first load or if you want to do some paging. And because it's all client-side it will be far more fluid than re-downloading at every criteria change.
I'm creating a web application in which I need to Check the Database in regular Intervals for any new rows Updated in the table. If any Rows have been updated and return the Rows to the user.
When I refresh the Page I update the rows in my Website. But I need to Know If any new Rows have been added to the Table without refreshing the Page
How can I achieve this ??
Can you suggest me a Method (Probably which doesn't slow down the web site).
Can I achieve this using web services??
The usual way to do this is using javascript to hit a page on your website with setInterval posting back to a page to ask about any changes, web sockets can do this real time but require modern browsers.
Here is a similar question that's been answered well, though it's for Asp.net MVC:
Creating an AJAX alert for a user when there's a server-side change
If I'm being forced to use vanilla ASP.Net I do usually put those kind of requests into a webservice.
I'm developing a webpage where users can filter data and then export the selection to pdf or excel. The website is using ASP .NET C#.
To filter the data I have crated a webpage containing a left column with boxes and drop downs enabling users to enter search criteria and then click a search button. This is the typical search/filter functionality that a lot of websites contains. After filtering the data, the selecting is displayed using an asp listview. This listview generates a table. I've implemented Dragtable, enabling users to alter the sequence of the columns in this table, and also the columnManager enabling users to select which columns to display.
So my problem is that the filter/search functionality is resolved back-end using asp .net C#, while the selecting and rearranging of columns is done client-side using jQuery. When users now click the "export"-button, I'd like to collect the filter done by the asp controls in addition to the filter done by jQuery, and create the file. This file should only contain the columns selected using columnManager, in the same order they are in after being altered using dragtable.
What is best practice when using both server side filter and client side filter? I've also considered to drop all of the server-side filtering and use only ajax.post() to send all filters in JSON format to the server.
I also want to enable users to save their current filter for another time.
Update
I've decided to drop the server side and use ajax (getJSON to be more precisely) to get the search result. This way I don't loose the ordering and sorting of columns that is done with jQuery/js, which I would with a post-back (could use cookies'n stuff, of course).
I also keep all the logic in one place, and JSON objects can easily be wrapped/unwrapped server-side. Thanks for your answers, though!
It's not at all bad to have Client side and Server side working at same place.
All the good applications running in the world have these combination together.
However we need to see the approach.
If you don't want any postbacks , I would recommend to go with Jquery.
If you are ok with roundtrips, go ahead with Server Side and Ajax.
Your approach has another problem: What happens if the user orders the columns first and than filters it? The order of the columns is resetted.
However with the jquery ui draggable you are able to fire ajax calls to notify the server side code about the change. You can bind a function to the stop event: http://api.jqueryui.com/draggable/#event-stop
So I would do the following:
Fire ajax call when the user changes the order of the columns, but do not refresh the data
Fire ajax calls when the user adds a filter AND refresh the data
The server side code is always up to date and renders the correct ouput if it has to.
Refresh the Grid Automatically when table changes in the DB
like twitter and other facebook .
how to do this using any asp.net controls using c#
Pokein(Reverse AJAX Library) can help you
Doc
Sample project
You can use polling to check database changes if changed update page. For this you have to use AJAX UpdatePanel Timer controls.
If you want to do it automatically you need socket programming.
You can try this Comet based grid control.
You could create a function that checks whether database changes have been made, and then poll that function using async calls (jQuery in your View)
I want the user to click the link then the window pops up, but I want the data inside the window to be pulled from a database, and I need to repeat this process for 5 links that are also pulled out of a database. Say the most popular items for the month. My question is how would this be best accomplished? Jquery, or AJAX. I am just trying to see which would be the easier way to go about coding this with .net and C#. If anyone has any tutorials related to this at all that would be wonderful. Thank you guys in advance.
The most simplest solution I think you can either just code the window as a separate page asp.net page. In the code behind you can get the data from the database. The link would just open this page as a popup modal window. When the page executes, it will get the data from your database.
A more elaborate solution if your doing something more fancy say if you want to use jQuery dialogs would mean that you would have to get the content of the dialog using ajax, which can be called when the user clicks the link.
You can use JQuery with the Ajax API - use the http://api.jquery.com/jQuery.get/ method to call a web service e.g. a .net wcf service over http. In the jquery script you can call the .get(...) method that calls your service (that then gets the data from the database). With the returned data you can replace the contents of a div element, which then you can use for a jQuery dialog.
$.get(WEB_METHOD_URL,
{ param1: XXX, param2: YYY },
function (data) {
$('#ID_OF_DIV').empty().append(data).dialog('open');
});