---
title: "How to call server-side function from client-side in ASP.NET?"  
description: "How to call server-side function from client-side in ASP.NET?"  
author: "marcel ethan"  
published: 2014-08-23  
updated: 2014-08-23  
canonical: https://www.mindstick.com/forum/2110/how-to-call-server-side-function-from-client-side-in-asp-dot-net  
category: "asp.net"  
tags: ["asp.net"]  
reading_time: 1 minute  

---

# How to call server-side function from client-side in ASP.NET?

I have a [web page](https://www.mindstick.com/forum/718/sql-server-report-alignment-to-center-of-web-page) having [asp.net](https://www.mindstick.com/articles/934/default-folders-available-inside-the-asp-dot-net-application-folder) [button control](https://www.mindstick.com/forum/148/problem-in-assign-css-on-button-control-by-javascript) and [textbox](https://www.mindstick.com/forum/12714/dynamic-textbox-in-gridview). I want a [confirm](https://answers.mindstick.com/qa/115761/facebook-account-locked-with-confirm-your-identity-loop) [message](https://www.mindstick.com/forum/12802/show-confirmation-message-yes-or-no-in-asp-dot-net) box, when someone changes the [content](https://www.mindstick.com/articles/13019/get-the-best-content-marketing-pricing-packages-for-your-brand) of textbox and click on button. If user click on yes then [event](https://www.mindstick.com/articles/167719/marquee-hire-benefits-of-event-lighting-hire-london) of button should fire other wise nothing should happen. All I want is to implement AJAX call back, but it is not working with ASP.NET button control.

## Replies

### Reply by Sumit Kesarwani

Hi Marcel, \

Just add the following code to your aspx code

<asp:[Button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) ID="btn1" OnClientClick="return confirm('sure?');" runat="server" Text="Button" />

Hope this will solve your problem.


---

Original Source: https://www.mindstick.com/forum/2110/how-to-call-server-side-function-from-client-side-in-asp-dot-net

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
