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

Top 5 Contributors of the Month
Gaurav Pal

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum


Posted By: DPK     Posted Date: September 21, 2008    Points:2   Category :ASP.Net
Hello Friends,

I am using dotnet 3.5, I want to use a function in button_click and I want that function to be called through AJAX, tell me pls how can I call this function using AJAX.

Thanks in advance, cheersss!!!

Author: Pankaj Mishra             
Posted Date: September 21, 2008     Points: 5   

if you are using Visual Studio 2008 the Ajax extension somes along with that. Now add one page "Ajax Web Page" in your project. Now Drag "Update Panel" in you web page. Your aspx page should look like this.Below example shows the time on button click.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:Button ID="btnCallAjax" runat="server" Text="Call Me"
onclick="btnCallAjax_Click" />
<asp:Label ID="lblDateTime" runat="server"></asp:Label>

Now in your .cs page

protected void btnCallAjax_Click(object sender, EventArgs e)
lblDateTime.Text = DateTime.Now.ToString();

Hope this will give you an idea


Author: DPK             
Posted Date: September 22, 2008     Points: 5   

yes Pankaj thanks cheers!!!!!!!! :)

Author: DPK             
Posted Date: September 22, 2008     Points: 5   

Hello Pankaj!

If as u said to use "Ajax Web Form" but what if I do the same thing in normal web Form, like drag update panel and do all the same as "Ajax web Form" so there will be any difference between them?

And one thing more can u tell me pls that why is AJAX fast..when we use the AJAX how will page go to the server, I mean whole page will go to the server or any partial part only will go.

Thanks in Advance!!!

Post Reply

You must Sign In To post reply
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery

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