.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links


Posted By:      Posted Date: October 14, 2010    Points: 0   Category :ASP.Net
I have a simple add to cart function/form that is working. i would like to update a partialview 
in the master page that just gives the summary. when an action link is clicked it will update, but not using the ajax form.
i can understand why, but i don't know how to call an update or controler action on return. My controler for the add to 
cart is returning a json dataset. i just can't get it to the user control.
        public ActionResult AddToCart(int id, FormCollection collection)

            // Retrieve the product from the database
            int qty = 0;
            int.TryParse(collection["Qty"], out qty);
            var newItem = new ProductAddToCartViewModel();
            newItem.Product = Database.Products.Single(product => product.ProductId == id);
            newItem.Quantity = qty;
            // Add it to the shopping cart
            var cart = ShoppingCart.GetCart(this.HttpContext);

            var results = new ShoppingCartViewModel
                CartTotal = cart.GetTotal(),
                CartCount = cart.GetCount(),

View Complete Post

More Related Resource Links

Using ajax to submit and update form


Hi all,

  I'm new to ajax and not sure if it's necessarily the technology I need to accompolish what I'm looking to do. What I'd like to have is a simple two textbox and button form that let's the user submit some credentials (not for logging in) but instead to verify their identity for other purposes.  I would label the button as "Continue" and assuming it passes through, the form would update with some new data entry controls that would allow them to submit some final information.  I thought perhaps ajax would be a nice way to do this since I wouldn't need to create a second continuation page from the first to display a new form.  However, I'm unsure how it's possible to update the form in the first place to look different.  Or is there perhaps a cleaner way to do this?  Any help would be appreciated.  Thanks

AJAX Form POST Request to a DLL Problem

I am using AJAX javascript for POSTING a complete HTML form to the server which is an external dll on a different server and displaying the response. The server-response is displayed in a "div" . basically i need to show a poll in a .aspx page which is basic a question with 3 options & a button. Now on click of submit button i need to post the data to a dll & show the result from the dll itself. Any idea how to do this? is it possible..any code???

AJAX, Data Form Web Part, and Paging

I've placed a Data Form Web Part into an Update Panel, and it works great.  This particular use of the web part requires Single Item mode with paging.  My problem is that the "Previous" button for paging calls a javascript function for "history.back()".  Well, the only history to go back to since I am using AJAX around the web part is whatever page (if any) that the user was on before navigating to the page with the AJAX functionality.  It does not go to the previous list item.I've copied the function from the "Next" button, and created my own xslt variables to pass into it for the previous item:<xsl:value-of select="ddwrt:GenFireServerEvent(concat('dvt_firstrow={',$PreviousRow,'};dvt_startposition={',$PreviousPageData,'}'))" />This works fine UNLESS items are deleted from the List that is providing that data to the Web Part. Then my idea doesn't work because it is trying to look for ID numbers that do not exist in the list anymore.  Does anyone know of a way, or a built in variable from the ddwrt namespace, that will pass the previous list item to the "Previous" button no matter if there are deleted items (missing ID numbers) in the providing list? I would greatly appreciate some help.Thanks. Jason A. Graham http://jasonAgraham.spaces.live.com

Ajax Post Form


Ok I have an interesting new assignment that I am trying to come up with the best solution for. Basically I have a web application that needs to provide access to another system from within a secured login, each application is at a different site. Basically the third party company that has the system I need to connect with wants me to access their site via a form post. This would typically not be a problem other than I need to have the option to connect from inside of pretty much every existing page withn the primary application. Each connection option will be some type of hyperlink that will then in turn target a new browser window to display the content from the third party. So obviously I cannot use the standard form post methods as the page form is already in use.

So my thought was to use Jquery Ajax Post, I use it all the time for typical Ajax functionality with other applications, but that is normally interaction with a webservice or webmethod. What I was thinking, is to create a post function to send all the required fields along to the third party company, without the need to actually create the form. Typically in the past when I have used this functionality I am returning some type of data that I just redisplay or interact with, but now I need to target a new browser and open the returned page. The third part

Why does ajax control not move onto form



Been following help video "Get Started with the ASP.NET AJAX Control Toolkit?" and I got as far as adding a Control from the Ajax toolbox but for some reason the control will not add to the form.

Anyone explain as to why might be.


ajax form, add textbox dynamically


Having FooTable1: id, name, lastname and FooTable2: idfromtable1, address... How can I make a view insert where i can have a button (ajax one) to add a textbox relative to FooTable2.address? I want it to work so people could add as many adresses as they want, jsut by clicking the button again to add a new field. I'd like to do so without using JQuery

AJAX web form size


We have developed an ASP.Net 3.5 application which includes a form for the user to fill in and submit to the server. The form contains some 40 controls or so (mostly textboxes, drop down listboxes, and some custom web controls) which are being validated (some using Custom Validators and server-side logic). To make the user experience feel like a connected session we have used AJAX (a ScriptManager and an Update Panel containing all page controls.)

Although the application is performing quite well when deployed onto a LAN environment, when published onto the web, the users experience long delays (some 20 seconds to refresh the page or to have validators check each control); for slow link users, this can take up to a minute or more.

After investigating the issue a bit, I discovered that if I save the page from the browser, it saves some 600K, most of which being some 13 ScriptResource.axd files and a couple WebResource.axd. I have no idea of what these are, but I suspect they are AJAX javascript libraries..

By removing the ScriptManager from the page, I get the page size to a more reasonable 90K size.


Can somebody please explain to me why this is happening? Is there a way to minimise my page size and still use AJAX?



Handling Form Controls After Ajax.BeginForm Submission


Currently I have a comments section integrated into a blog I am writing. 
The comments are Ajaxified, when you post a comment the comment list auto updates with the comment you just added. 
Everything is working great but I would like to do some cleanup after a comment is successfully posted. 
Specifically I would like to disable the textarea and submit button which I would have no issues doing through javascript by using the AjaxOption OnComplete parameter.
To avoid double posts or just plain abuse. I know I will need other safegaurds as well but this is my first step.
The thing is Ajax.BeginForm does not give the form an id or name so I can not reference the form in javascript.
Is there a workaround here? Can I disable these form controls from the controller? 

Here is my code.

<% using (Ajax.BeginForm("Details", new AjaxOptions {UpdateTargetId="divCommentList"})) {%>
    <p>Add Your Own Comment</p>
    <p><%= Html.TextArea("Comment1")%></p>
    <input type="submit" value="Add Comment" id="submit" />
    <% } %>

BlockUI in case of page submit. (for normal and ajax form submit)


Hi I want to implement BlockUI, the requirement is as below

1) On page submit it should gray out the page, it can be a normal submit (eg. Button click handled in code behind without any update panel used in page.)

2) Should be grayed out till the page is fully loaded (in case of button click, Page redirect).

My application pages can have hierarchy nested master page or at least one master page.  

I want to gray out the page in any case if page is submitted, that the stuff i want to achieve.

Thanks in advance.


Form View with Ajax Tab , Is there a better way to do this?


Good day all,

I know there is a better, faster  way to do this but  I couldnt figure it out.



    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ConnectionString %>" 
        SelectCommand="SELECT Schools.SchoolID, Schools.Name, Schools.Address, Schools.City, Schools.Province, 
                        Schools.Postal, Schools.Phone, Schools.Fax, School_Pictures.PictureID, School_Pictures.ImageURL, 
                        School_Pictures.Height, School_Pictures.Width, School_Pictures.ALTtext, School_Pictures.Tooltip, 
                        FROM Schools INNER JOIN School_Pictures ON Schools.SchoolID = School_Pictures.SchoolID 
                        WHERE (Schools.SchoolID = 2003) ">
            <asp:FormParameter DefaultValue="2003" FormField="Form1" Name="2003" Type="Int32" />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" 

Microsoft AJAX CDN

Content delivery networks (CDNs) are composed of "edge cache" servers that are strategically placed around the world at key Internet network points. These "edge cache" servers can be used to cache and deliver all types of content - including images, videos, CSS and JavaScript files.

Using a CDN can significantly improve a website's end-user performance, since it enables browsers to more quickly retrieve and download content. For example, instead of having a browser request for an image traverse all the way across the Internet to your web server to download, a CDN can instead serve the request directly from a nearby "edge cache" server that might only be a single network hop away from your customer (making it return much faster - which makes your pages load quicker).

AJAX GridView Checkbox Select All in ASP.Net

In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

AJAX GridView Paging and Sorting using C# in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

GridView Paging Using Ajax in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

jQuery $(document).ready() and ASP.NET Ajax asynchronous postback

Many call it the ASP.NET jQuery postback problem, but using the technique below should make it no problem anymore. $(document).ready() isn't called after an asynchronous postback. What this means? You lose the functionality that should be executed within $(document).ready() after an UpdatePanel rendered its contents after an asynchronous postback.

Making Ajax Callbacks to the Server Using jQuery with ASP.NET

In the first part of this article series I introduced jQuery's functionality and how it provides a rich client side programming model. This time around I'll expand on these concepts and show you how you can use jQuery in combination with ASP.NET using it as an AJAX backend to retrieve data. I'll also discuss how you can create ASP.NET controls and otherwise interact with jQuery content from ASP.NET pages in WebForms.

jQuery is just a JavaScript library so it will work seamlessly with ASP.NET both from page code as well as through backend driven code using the Page.ClientScript object or ScriptManager. You can use jQuery on its own as a client side and Ajax library that communicates with ASP.NET or you can use jQuery in combination with ASP.NET AJAX. The two actually complement each other quite well as jQuery provides functionality that the ASP.NET AJAX library does not and vice versa. For the most part the interaction between the two libraries is trouble free except for a few very rare edge cases.

Building a grouping Grid with GridView and ASP.NET AJAX toolkit CollapsiblePanel

I've posted an update to this post to apply on demand loading of Details data using ASP.NET AJAX PageMethods. I'm demonstrating the usage if CollapsiblePanelExtender client events on the new post. Check it out.

I admit, Matt Berseth is really inspiring me! Few days ago I pass through 2 of his great posts:

.Surrounding your Data Table and Dialog Controls with ComponentArt Styled Panels
.Building a Grouping Grid with the ASP.NET 3.5 LinqDataSource and ListView Controls
The first one is pure design tips one which I used for making good presentation of my demo here. The 2nd post is actually the idea.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend