I want to stop the Load Image ProgressBar of Jquery by clicking the button present on the Load Image ProgressBar and display the data how much have been loaded in the span of the before the button click into the repeater controle till that time.
---------------My Front End Code-----------------------
function ShowProgress() {
setTimeout(function () {
var modal = $('
');
modal.addClass("modal");
$('body').append(modal);
var loading = $(".loading");
loading.show();
var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
loading.css({ top: top, left: left });
}, 200);
}
function LoadDefaultPage() {
HideRepeater();
ShowProgress();
}
function HideRepeater() {
$('#<%= PnlRptr.ClientID %>').hide();
$('#<%= PnlRslt.ClientID %>').hide();
$('#<%= Resultset.ClientID %>').hide();
$('#<%= lblOutput.ClientID %>').hide();
}
<%----%>
Loading. Please wait.
--------------------------My Cs Code----------------
protected void btnSrch_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(4000);
Search();
}
public void Search()
{
Resultset.Visible = true;
PnlRslt.Visible = true;
try
{
WorkerGroup Result = new WorkerGroup();
BFSearchFunction SearchFnctn = new BFSearchFunction();
var SearchText = txtSrch.Text.Trim();
if (SearchText.Contains(","))
{
lblOutput.Text = "SearchText Format Can Be Only In 'FirstName LastName' Not In 'LastName,FirstName'";
lblOutput.Attributes.Add("style", "color:Red;font-size:15px;");
LblReslt.Text = "Search Records Count: 0";
ExcelExprt.Enabled = false;
rptrSrch.DataSource = null;
rptrSrch.DataBind();
}
else
{
string FirstString = string.Empty;
string SecondString = string.Empty;
var Index = SearchText.LastIndexOf(',');
if (Index != -1)
{
FirstString = SearchText.Substring(0, Index).Trim();
SecondString = SearchText.Substring(Index + 1).Trim();
SearchText = FirstString + " " + SecondString;
}
Result.Name = SearchText;
Result.Department = txtDrpt.SelectedItem.Text;
Result.Phoneno = ddlsrchby.SelectedItem.Text;
Result.Location = ddllctn.SelectedItem.Text;
List Output = SearchFnctn.SearchResults(Result);
if (Output.Count == 0)
{
LblReslt.Text = "Search Records Count:" + Output.Count.ToString();
lblOutput.Text = "No Result found for your entries";
lblOutput.Attributes.Add("style", "color:Red;font-size:15px;");
rptrSrch.Visible = false;
ExcelExprt.Enabled = false;
ViewState["Result"] = Output;
}
else
{
lblOutput.Text = "";
LblReslt.Text = "Search Records Count:" + Output.Count.ToString();
rptrSrch.DataSource = Output;
rptrSrch.DataBind();
rptrSrch.Visible = true;
ExcelExprt.Enabled = true;
ViewState["Result"] = Output;
}
}
}
catch (Exception)
{
throw;
}
}
modal.addClass("modal");
$('body').append(modal);
var loading = $(".loading");
loading.show();
var top = Math.max($(window).height() / 2 - loading[0].offsetHeight / 2, 0);
var left = Math.max($(window).width() / 2 - loading[0].offsetWidth / 2, 0);
loading.css({ top: top, left: left });
}, 200);
}
function LoadDefaultPage() {
HideRepeater();
ShowProgress();
}
function HideRepeater() {
$('#<%= PnlRptr.ClientID %>').hide();
$('#<%= PnlRslt.ClientID %>').hide();
$('#<%= Resultset.ClientID %>').hide();
$('#<%= lblOutput.ClientID %>').hide();
}
Search: | Department: | |||
SearchBy: | Full Name Phone Number First Name Last Name | Location: | ||
CssClass="mybtn"> | ||||
<%----%>
Loading. Please wait.
--------------------------My Cs Code----------------
protected void btnSrch_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(4000);
Search();
}
public void Search()
{
Resultset.Visible = true;
PnlRslt.Visible = true;
try
{
WorkerGroup Result = new WorkerGroup();
BFSearchFunction SearchFnctn = new BFSearchFunction();
var SearchText = txtSrch.Text.Trim();
if (SearchText.Contains(","))
{
lblOutput.Text = "SearchText Format Can Be Only In 'FirstName LastName' Not In 'LastName,FirstName'";
lblOutput.Attributes.Add("style", "color:Red;font-size:15px;");
LblReslt.Text = "Search Records Count: 0";
ExcelExprt.Enabled = false;
rptrSrch.DataSource = null;
rptrSrch.DataBind();
}
else
{
string FirstString = string.Empty;
string SecondString = string.Empty;
var Index = SearchText.LastIndexOf(',');
if (Index != -1)
{
FirstString = SearchText.Substring(0, Index).Trim();
SecondString = SearchText.Substring(Index + 1).Trim();
SearchText = FirstString + " " + SecondString;
}
Result.Name = SearchText;
Result.Department = txtDrpt.SelectedItem.Text;
Result.Phoneno = ddlsrchby.SelectedItem.Text;
Result.Location = ddllctn.SelectedItem.Text;
List Output = SearchFnctn.SearchResults(Result);
if (Output.Count == 0)
{
LblReslt.Text = "Search Records Count:" + Output.Count.ToString();
lblOutput.Text = "No Result found for your entries";
lblOutput.Attributes.Add("style", "color:Red;font-size:15px;");
rptrSrch.Visible = false;
ExcelExprt.Enabled = false;
ViewState["Result"] = Output;
}
else
{
lblOutput.Text = "";
LblReslt.Text = "Search Records Count:" + Output.Count.ToString();
rptrSrch.DataSource = Output;
rptrSrch.DataBind();
rptrSrch.Visible = true;
ExcelExprt.Enabled = true;
ViewState["Result"] = Output;
}
}
}
catch (Exception)
{
throw;
}
}

Answers
Know the answer? Post it. Somebody with the same question will find it here.