My first Ajax Program Part 2

0

Written on 9:54 PM by Mj blog

My first Ajax program might have given a hint how its going to code ajax program in visual studio or web express edition. But there is a logical issue as a developer. What happens for a AJAX website in slower connection , traditionally a web page refreshes to give a indication to users that the web page is loading or some request response is happening but in AJAX nothing will happen since the page is not refresh only data is send in the xmlHTTPRequest the users might be confused ............ so what to do ?

tradionally we will think of using a progress bar in java script or some loading pics and code in javascript ..... lot of confusions rite. Luckly AJAX team has given a control called updatepanelprogress control. All you have to do is place the control in the design view or source view and map the update panel . Update progress control also allows us to keep traditional pictures or HTML or table etc so keep a Picture of GIF or put a text in there

the syntax looks like this








Just map the updatepanel and give the now loading text. when ever you hit the button with post back option the updatepanel will send the xmlHTTPRequest and Invokes the UpdatePanelProgress will invoke the Loading ... Message giving the end user that some action is being taken places and keep waiting ....

My First Ajax Program part 1

1

Written on 8:49 PM by Mj blog

My First Ajax Program being a web developer i was always eager to see whats new in web 2.0 but for past 6 months i have not touched web was working in sql clr u all might have seen in the previous post so lets start with my first AJAX program in ASP.net 2.0.

Lets kick start ...

Pre requisties

Let the game begain : May be the force with (say in starwars style)

open visual studio now create new website or file --> new --> website

choose ASP.NET AJAX-Enabled website

looks like this



Give the file path and project name and it will create a new website. open the default.aspx page.
open the tool box now you will find a new tab Ajax extension in the tool box


click the scriptmanager and drag & drop or double click it and put in the design view the source view look like this


and then drap the updatepanel to the design view

Now place any control with postback eg: button, gridview etc inside the updatepanel







in the the codebehind Default.aspx.cs


protected void Button1_Click(object sender, EventArgs e)
{

Label1.Text ="hello World";
}

compile the website and press F5 or Ctrl F5 to run the application

click the button and you will notice the page is not refreshing but label text only changes

This is the first AJAX program.