I have a question about how to use JQuery progress bar to wait until long process finished.
I have a web page with a button and when the user hits this button ,some operation on server occurred. For example inserting records into DB like this:
Int32 val = Int32.Parse(Request.QueryString["PLCID"].ToString());
String _MachineName = String.Empty;
_MachineIP = String.Empty;
DBLayer.getMachineByPLCID(val, out _MachineName, out _MachineIP);
I need to show progress bar for the user and prevent him from taking any action till the process finished.
please help!
If you want only to disable the button and make redirection after the processing has finished, you can use this sample:
http://tpeczek.com/2010/07/reporting-server-side-operation.html
You just need to replace re-enabling the button with proper call to window.location.
Related
I made the rails app that parses one website. I wonder, whether it is possible to show the process of the parsing in a progress bar which will be shown on a main page(to start the process you need to click the button)? I think I need to use bootstrap for view of progress bar, but how to pass the process of execution itself into view of bar?
Edit:
The parser itself is situated in the model that stores result to the database after each step i. e. if parser detects first company and its data - save, then the second company and so on. The progress bar will show result based on information from database(I don't understand how to use ajax for this) and I really want to use bootstrap progress bar, not jquery bar.
My model-parser
class PrintingHouses < ActiveRecord::Base
require 'mechanize'
agent = Mechanize.new
page = agent.get('http://www.print-index.ru/default.aspx?p=84&gr=198')
sum=0
loop do
page.search('.goodname .goodname').each do |n|
link = Mechanize::Page::Link.new(n, agent, page)
new = link.click
name = new.search('#ctl00_ctl00_BaseCentralRegion_CentralRegion_lblGoodName h1')
address = new.search('.address')
phone = new.search('.phone')
email = new.search('.email')
website = new.search('.www')
PrintingHouses.create(name: name.text.center(100), address: address.text.strip,
phone: phone.text.strip, email: email.text.strip,
website: website.text.strip)
end
num = page.search('.goodname .goodname').count
sum=sum+num
break unless link = page.link_with(:text => " » " )
page = link.click
end
puts sum
end
This question is marked as a duplicate but I didn't find anything that could help me so please help.
The gem Progress Job looks promising for providing progress updates on background jobs. At this time it looks like it works with DelayedJob.
When i click on button need to display message instead of loading image for long running process.Need to show what is happening in my code behind.Like below stages
Collecting information from database..........
Generating PDF document..............
Sending e-Mail........
Done.
Note:No need to set default time for stages it need to take message from code behind and display.
Please send me any related links.
Thanks in advance.
Check out Easy incremental status updates for long requests
You could easily add a TextBox control and change the Text property by your code behind, in function of what you do.
For example:
private void Loading()
{
txtLoading.Text = "stage1.Collecting information from database";
// PUT CODE TO COLLECT INFORMATION FROM DATABASE HERE
txtLoading.Text += "\r\nstage2.Generating PDF document";
// PUT CODE TO GENERATE PDF DOCUMENT HERE
// ETC ETC
}
Hope it helps :)
I am attempting to force open the print dialog so that all the user has to do is set the email address and press ok. I've found multiple tutorials on how to print a report to file or a printer without the print dialog, but that's not what I'm looking for.
Typically to email a report, the user displays the report, clicks the print icon in the tool bar, and then chooses email and sends it. I want to cut out the first two steps automatically.
This is one of my many attempts at doing this so far, but to no avail.
void emailInvoice()
{
Args args;
ReportRun rr;
Report rb;
PrintJobSettings pjs;
CustInvoiceJour record;
;
select record where record.RecId == 5637175089;
args = new Args("SalesInvoice");
args.record(record);
args.parmEnum(PrintCopyOriginal::OriginalPrint);
// Set report run properties
rr = new ReportRun(args,'');
rr.suppressReportIsEmptyMessage(true);
rr.query().interactive(false);
// set report properties
rb = rr.report();
rb.interactive(true);
// set print job settings
pjs = rr.printJobSettings();
pjs.fileName(strfmt("C:\\Users\\gbonzo\\Desktop\\%1.pdf", record.SalesId));
pjs.fitToPage(true);
// break the report info pages using the height of the current printer's paper
pjs.virtualPageHeight(-1);
// force PDF printing
pjs.format(PrintFormat::PDF);
pjs.setTarget(PrintMedium::Mail);
pjs.viewerType(ReportOutputUserType::PDF);
// lock the print job settings so can't be changed
// X++ code int the report may try to change the destination
// to the screen for example but this does not make
// sense when running a report here
pjs.lockDestinationProperties(true);
// Initialize the report
rr.init();
rr.run();
}
Thanks in advance for your help!
Have you tried to develop a RunBase standard dialog class (RunBaseBatchPrintable if you need to select the printer) that get all the dialog fields you need and from there, programatically run the report passing all the desired parameters? I'm prety sure it will work, and probably will left a cleaner code separating the report of the logic needed to the user interaction.
Read an example here:
http://waikeatng.blogspot.com.es/2010/10/using-runbasebatchprintable-class.html
You have to call the prompt() method of the ReportRun class before calling the run() method.
if (rr.prompt())
{
rr.run();
}
The prompt() method will show the print dialog. If you want it easier for your users you could use the SysMailer class, take a look to the quickSend() method.
I have a requirement that is :--
On click of ‘Logout’ link, popup message “This will terminate the session and close the browser. Do you want to continue?” with Yes and No buttons. On click of ‘Yes’, session should be terminated in IIS server and current tab of browser closed.
To implement this I have writen below piece of code but I dont know how to terminate the session on IIS
<script language="vbscript">
Function OnClickLogout()
dim Answer, msg
Msg = "This will terminate the session and close the browser. Do you want to continue?"
Answer = MsgBox(Msg, vbYesNo + vbCritical, "Error")
if Answer = vbYes then
window.close
else
'Retrun to the previous page
end if
End Function
</script>
Could anyone please suggest me how to do this in vbscript. My website is in ASP but its a legacy application so I have to do the code!!!
Couldn't you simply use JavaScript? We us it all the time at work in our ASP Classic projects. Something like that to start off:
function DeleteProductGroup(){
var r=confirm("Are you sure you want to delete this product group?");
if (r==true){//here goes the code if user presses YES
}
else{//here goes the code if user presses NO
}
}
Environment : ASP.NET, C#
I am writing a web program that will export 12 tables to another database. When the user click the "Export" button, the export process will get started. The thing is, I like to show some messages to client such as "preparing..., deleting old records..., exporting..., export completed."
But now, It is showing all status once 12 table are completed.
Please guide me how to do this.
Doing long processes like this is on a web page is probably not a good idea, you will need change the timeout settings on pages etc
Rather build a windows service that does all the work. You can then use the Page to initialte the process. The service could update some status that is read by the page. This way the page does very little work, ie initiate the process and poll for status updates. This can be done via simple jquery/ajax calls.
try this
put this on c#
and call ajavascript function per process
Page.RegisterClientScriptBlock("1","alert('add to table now')");
Use a javascript timer to periodically load content from a status page or service.
The timer is fairly simple:
setTimeout('checkProcessStatus()', waitTime);
The update itself depends on your choice of tech - for instance if using MVC and jQuery:
function checkProcessStatus() {
//dynamically add the html from the status page to <div id="taskStatusPanel"
$('#taskStatusPanel').load('export/status/' + taskId);
//set timer to call this again
setTimeout('checkProcessStatus()', waitTime);
}
Then the ExportController.Status action would return a simple view that displayed the HTML for the current status.