Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Stop the execution of a function when a button is clicked in ASP.NET

$
0
0

I have an ASP.NET application in which I have a function that runs on a button click event, all I need is to have another button which when clicked the function that is running should stop executing. I have added the sample code. Can someone please help me on this? Thanks

protected void btnCreateSites_Click(object sender, EventArgs e)
{
  GenerateSites("CPM");
}

static void GenerateSites(string siteName)
{
  //perform some complex operation here
}

protected void btnStopExecute_Click(object sender, EventArgs e)
{
  //stop the execution of the GenerateSites() function when this button is clicked.
}




Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>