|
Can't be done. There is no way to create a piece of software that can handle any and all file formats and correctly send them to a printer.
I am also glad it can't be done. No web page should be able to take over my hardware. I can just imagine some shady ink cartridge company with a banner for ink refills printing several pages of 8x10 black squares and their ad says "Are you low on ink? Maybe you should check again."
|
|
|
|
|
Below may help you
<button onclick="printPage()">print</button>
<div id="printerDiv" style="display:none"></div>
<script>
function printPage()
{
var div = document.getElementById("printerDiv");
div.innerHTML = '<iframe src="mypage.aspx" onload="this.contentWindow.print();"></iframe>';
}
</script>
For more help : pranayamr.blogspot.com
|
|
|
|
|
hy...thnks for the code..itz working fine...but i want to set default printer settings so that the print dialog doesnt come out..
can u please tell me how i can do that...
|
|
|
|
|
Dear friends,
I am trying to upload one excel file to sqlserver database by using fileupload control. I am initially uploading the file and saving in a temporary folder and from this temporary folder I am copying the data to SqlServer Table. After copying the data, I want to delete the file in Temporary Folder. I wrote File.Delete(filename) code, but it is throwing following exception
[System.IO.IOException] = {"The process cannot access the file 'E:\\SourceSafe\\ESSP\\Finance\\FinancePL\\uploadedfiles\\samplePS.xls' because it is being used by another process."}
It is not allowing to delete the file. Please, can anyone help me in this. It's very urgent. Please....
Thanks,
Dileep.
|
|
|
|
|
You have to release resources used during the first phase of your code, which is saving file into physical space/directory. For example:
fileObjectUsed.dispose();
OR
FileUpload1.dispose();
I would recommend you not to store file into your web server location as this will add extra overhead of saving and deleting files and of-course security problem. You can directly store it(file) into database by converting it to bytes. Check out the link Storing Binary Data to Database using ASP.NET 2.0[^]
Observe the code lines...
Dim imageBytes(fileUpload1.PostedFile.InputStream.Length) As Byte
fileUpload1.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length)
puranonnet@hotmail.com
BCS Technology
|
|
|
|
|
Lots of information missing though. The moment you uploaded it to temp folder, how do you upload it to database? Is the upload to DB process simultaneously going on? Immediately or afterwards? Is that process of uploading to DB is in progress when you try to delete it?
Looks like the temporary folder is a Sourcesafe folder. Those are write protected.
Lastly, you should directly upload it to DB instead of inserting an extra step in between and having a performance hit!
|
|
|
|
|
i m using UrlRewritingNet and url rewriting is working fine but i m facing a serious issue. i have just one page in the site. and lots of updatepanel are used in the sites. i have use the rules as u define in ur article.
<urlrewritingnet
rewriteOnlyVirtualUrls="true"
contextItemsPrefix="QueryString"
defaultPage = "default.aspx"
defaultProvider="RegEx" xmlns="http://www.urlrewriting.net/schemas/config/2006/07" >
<rewrites>
<add name="Detail"
virtualUrl="^~/detail/(.*).aspx"
rewriteUrlParameter="ExcludeFromClientQueryString"
destinationUrl="~/detail.aspx?s=$1"
redirect="none"
ignoreCase="true"
/>
</rewrites>
</urlrewritingnet>
i have check when the paging is clicked the response is sent to the server but the pagebutton click event is not fireing.
and as a result i get this error.
Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '
<!DOCTYPE html P'.
i hope u will have solve this problem.
i think its .axd problem please sugest a solution.
amirzada
|
|
|
|
|
It looks like you want to ask this question to an author related to his/her article.
I would suggest you to please use the forum present at the end of the article in order to reach author and get quick response. Rarely you will find authors reading this forum.
Please post the same at the article's message forum.
|
|
|
|
|
hi,
i am having a page with gridview and i want to open the page in master page...so to do this i removed the runat server attribute from the page and on the link button of the master page i referred the page with gridview ...but showed me an error " form with gridview must have runat=server attribute". when i put this attribute...and try to open in master page, the page with gridview loads leaving the masterpage....i figured out that when my masterpage form and gridview page form tag both have runat= server attribute then the gridview page will be loaded leaving the masterpage.
Afiz Momin
|
|
|
|
|
please, tell me if u need a code .
|
|
|
|
|
What is this? Why are you posting to your question. In case you want to add anything to whatever you have asked, you can always go and edit it!
|
|
|
|
|
Ok! Here are few things you need to read on first...
1. What does runat=server means. So, basically, what will happen if you remove it or add it to the control.
2. Can a page that has a Master page have multiple form tags that has 'runat=server ' in it? How many form tags with runat=server is allowed?
|
|
|
|
|
runat=server attribute indicates that the element should be treated as a server control And page can have one or more forms in page.
How many form tags with runat=server is allowed? --> this thing i dont know.
but form requires a runat attributes when using GridView
Plz give briefing on this and solution to the problem..
thank u..
|
|
|
|
|
|
hello all,
I have made a project like OnlineExam.
In this, I want to restrict the Back button of the client browser so that after submitting the test, it should redirect last page or you can say results page. And if user clicks on the back button, it should not redirect to the Questions page again,
plz help
Thanks in advance.
|
|
|
|
|
Although, there are lots of hacks using javascript to disallow navigating back, but those are, as per my belief, not all foolproof. I would suggest you to use Cache.SetNoStore() on the page where you don't want to allow user to visit using back button. Back button actually presents the page using stored cache on browser client.
Here is the code which you can place in page load event...
Response.Cache.SetNoStore();
This will make each and every visit to this page to be fetched from server. You can add some code logic or session variable etc to check if it is a valid page request.
I hope this will help.
puranonnet@hotmail.com
BCS Technology
|
|
|
|
|
no friend..its not working ....i have already used it......
|
|
|
|
|
You need two session variables. ExamStarted and ExamFinished. Set the ExamStarted variable when they start the exam. When they submit the test set the ExamFinished variable. Then in every question page check for the ExamFinished session variable. If it is set then redirect.
|
|
|
|
|
You can disable the Browser back button such that the scenario does not occur:
Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.Cache.SetExpires(DateTime.UtcNow.AddHours(-1));
Response.Cache.SetNoStore();
You can add something similar in form aspx if you want to place it there:
<META Http-Equiv="Cache-Control" Content="no-cache">
<META Http-Equiv="Pragma" Content="no-cache">
<META Http-Equiv="Expires" Content="0">
OR
<SCRIPT LANGUAGE=javascript> { var Backlen=history.length; history.go(-Backlen); window.location.href=page url }</SCRIPT>
OR
Page.ClientScript.RegisterStartupScript(this.GetType(),"cle","windows.history.clear",true);
OR as you say in you logout event:
protected void LogOut()
{
Session.Abandon();
string nextpage = "Logoutt.aspx";
Response.Write("<script language=javascript>");
Response.Write("{");
Response.Write(" var Backlen=history.length;");
Response.Write(" history.go(-Backlen);");
Response.Write(" window.location.href='" + nextpage + "'; ");
Response.Write("}");
Response.Write("</script>");
}
|
|
|
|
|
I would approach it differently.
I would create multiple ascx files if you want different "pages" and step through these .ascx files by postback.
This makes the system far more extensible because if you want to add new questions, or add questions dynamically, all you have to do create another .ascx file and reference it in the .aspx page. Or, you could reate one .ascx file and load the questions dynamically from a database or XML file, and just use postback to keep track of each question. Keep track of the current question with a session state, but then the "back" and "forward" buttons become irrelevant because you are displaying whatever .ascx file you've selected in postback.
Ryan
|
|
|
|
|
I have used simple web page for the questions to be displayed. After submitting the questions, user redirects to another page i.e. thanks.aspx and in that page, I have used the session.removeAll() in the PageLoad event.
Now I want that when user clicks on the back button of his browser from that page(i.e thanks.aspx), Questions.aspx page should not display the same questions again. Instead, that page must be empty.
I hope u get my point..
thanks anyways
|
|
|
|
|
That's even easier to fix.
From what I understand you basically have two pages:
test.aspx and thankyou.aspx . Test.aspx as all of your questions and thank has all of your processing code. Test.aspx redirects to thankyou.aspx .
If this is the case, here is what I would do:
On any page before you go to test.aspx (I'm sure you have a page like (testinstructions.aspx), create a session:
Session[TEST_FINISHED] = false;
Then check the test page for the session:
bool bTestComplete = (bool)Session[TEST_FINISHED];
if (bTestComplete == true)
{
Response.Redirect(thankyou.aspx);
}
Finally, set a session on thankyou.aspx like this:
Session[TEST_FINISHED] = true;
So when the user lands on the test page, the TEST_FINISHED session is set to true. This will insure that the user is never able to go back to the test page.
Is that what you are looking for?
Ryan McBeth
|
|
|
|
|
yes ....I wanted to have like that and I have used that code in my project but every time, after clicking on the submit button of the test.aspx page & it redirects to the thanks.aspx, When user clicks on the back button,again it redirects to the test.aspx webpage and in that page,questions are displayed in the same way......
could you give me alternative of using sessions in my project ???
And thanks for the answer
|
|
|
|
|
It may be tough to do unless you use session states because you have to record the state of the user.
If you put the Response.redirect("thanks.aspx") in the page_load method along with the if Statement, it should work by kicking the user out.
But there is always another way. Let me think about it.
Ryan McBeth
|
|
|
|
|
Ok, brother I'm still on the case.
I can think of one more option if sessions are out of the question.
Create a third page called process.aspx . <ake the="" page_load="" method="" do="" same="" thing="" thank_you="" page="" did,="" but="" add="" an="" immediate="" redirect="" to="" thankyou.aspx
so="" business="" process="" would="" look="" like="" this:
test.aspx="" -=""> process.aspx -> thankyou.aspx
If the user hits the back button, they go immediately to process.aspx and get redirected back to thankyou.aspx . Now, this won't help if the user holds down the "back" key and chooses test.aspx, but it may work in 90% of your cases, and if you are having trouble with setting sessions, that may be good enough.
If that won't work, post your page_load method for test.aspx and thankyou.aspx and I'll take a look at it.
Ryan
|
|
|
|