I have a simple VB.Net web app that gets a large table based on Form controls and I need it display the progress such as Doing 'Record# nnn'.
This method can be simulated with via clicking on a button the the form is initiated which is the instance that we need to access. lblMsg is a label on the form what I would like to update.
We are currently trying the below but when GetTable gets control lblMsg is nothing which means that the form is not initialed.
How can I get this to work?
This method can be simulated with via clicking on a button the the form is initiated which is the instance that we need to access. lblMsg is a label on the form what I would like to update.
PublicFunction GetTable Dim I asIntegerfor I = 1to10 lblMsg.Text = "Doing Record# "& i Sleep 1000nextEndFunction
We are currently trying the below but when GetTable gets control lblMsg is nothing which means that the form is not initialed.
How can I get this to work?
$(document).ready(function () {
$("#btnTrial").click(function (e) {
e.preventDefault();
$("#btnTrial").attr('disabled', 'disabled');
var total = 5;
if (document.getElementById('<%=txtLoopRows.ClientID %>').value != "") {
var total = document.getElementById('<%=txtLoopRows.ClientID %>').value;
}
// comes here the first time
PageMethods.OperatePage(total, function (result) {
if (result) {
setTimeout($.updateProgressbar, 500);
}
});
});
});
<System.Web.Services.WebMethod(EnableSession:=True)> _ PublicSharedFunction OperatePage(total AsInteger) AsObject Dim session As HttpSessionState = HttpContext.Current.Session Dim totalParsed AsInteger = 0Integer.TryParse(total.ToString(), totalParsed) _TotalLoop = totalParsed ' 1 System.Threading.ThreadPool.QueueUserWorkItem(AddressOf ThreadProc, session) ' Sets to invoke ThreadProc ReturnNewWith {.progress = 0} EndFunction
<System.Web.Services.WebMethod(EnableSession:=True)> _ PublicSharedFunction ThreadProc(ByVal stateInfo AsObject) '2 ' Loops with sleep but sets StateVariable to the counter which is picked up by Progress Page then to $.updateProgressbar = function ' InfusionSoft stuff here Dim DefPage AsNew _Default DefPage.GetTable(stateInfo) ' Invokes but form variables are nothing stateInfo("TICK") = NothingEndFunctionThanks