i am working on my first little ajax project.
Basically i have no idea how to start. I created a AJAX enabled website and i have a simple page on there that basically has a list of items taken from a Class thats stored in the session.
So I have
1 Gridview that bases its DataSource to a Dataset i create from a object (just a class that contains an array list)
2. I have methods in place to loop through the array list, create a datatable and bind it to the gridview
3. I have a method that also removes a selected item from a dataset and refreshes the gridview its a "remove" button.
I would like to have AJAX handle the removal of items (for now, eventually i want the whole thing ajax enabled) but just to start i want to just activate my Remove method from ajax.
But i dont know where to go from here.
So what do i have to do to call my method via AJAX ?
Any advice or help appreciated!
thanks
mcm
well i seem to have figured it out although i dont know what i did or how it works!
I added the ScriptManager tag to the page.
I added an UpdatePanel surrounding my Gridview,
and now my REMOVE buttons work without postbacks!
Holy Momma! How did it do it?!? I thought i'd have to be writing javascript and hooking into new events , etc.
is it REALLY all this easy?
mcm
Yep, it can really be that easy. caveat, though; the UpdatePanels can get pretty heavy in terms of resource requirements if you use them extensively, and there are also issues with certain combinations of controls (witness the volume on the forum of "Update panel and my..." posts. For simple things like you're describing, they work very well, though.
great! So now that i have seen how easy it "can be". I do have a couple more questions.
I created a sample AJAX enabled site to test this bin and it works GREAT im so impressed with myself.
But how complicated is it going to be to make this a component. My idea for the site is to use Master Pages (another first for me)
and down the left side this "component" will sit. I still dont know wether to make it a component or just a content page.
There will be a repeater or a formView on the right with products to add to the bin. I want those to be ajax enabled too. Is it hard to make different elements in different content pages "speak" to each other? Really all im doing (as stated in the first post) is adding items to a Collection stored in a Session Variable (using a facade pattern with a SessionManager class)
Also. I am using the new Web Application templates to build my stuff (from ScottGu's blogs) Can i switch this AJAX enabled site to be a WEb Application and keep the functionality?
thanks,
mcm
No comments:
Post a Comment