I'm using ssrs with an asp.net reportviewer control to display server reports. We want to do away with the toolbar because it doesn't fit with our look and feel but we want to maintain some of the functionality, the one bit I'm struggling with is the print. Is there any way to bring up the same print dialog as the print button on that toolbar from the asp.net page?
http://msdn.microsoft.com/en-us/library/ms252091(v=VS.80).aspx
Is the closest that I’ve found, however I’m not using local reports (so it would make sense if there was a built in function around somewhere), and it skips the printer dialog portion which is unacceptable. I don’t believe that I can actually call the winforms printdialog on an asp.net page, but it’s not something I’ve tried.
Any help would be much appreciated.
Here is a script to bring up the print dialog:
<script language="javascript">
function PrintReport() {
var viewerReference = $find("ReportViewer1");
var stillonLoadState = clientViewer.get_isLoading();
if (!stillonLoadState ) {
var reportArea = viewerReference .get_reportAreaContentType();
if (reportArea == Microsoft.Reporting.WebFormsClient.ReportAreaContent.ReportPage) {
$find("ReportViewer1").invokePrintDialog();
}
}
}
</script>
To invoke, just call PrintReport()
Detailed explanation here:
http://blogs.msdn.com/b/selvar/archive/2011/04/09/invoking-the-print-dialog-for-report-viewer-2010-control-using-the-javascript-api.aspx
Related
I'm trying to upload a mraid project to Google's DoubleClick studio and notice the mraid.expand() event is not working properly. The ad is meant to be an in-app expandable banner, and basically after the very first time, mraid.expand() will not actually expand to full screen but rather expand to within the banner itself. The solution right now is this:
var isFirstTime = true;
...
if(isFirstTime) {
mraid.expand();
isFirstTime = false;
} else {
mraid.expand();
if (window.parent) window.parent.mraid.expand();
}
I noticed that because DoubleClick embeds everything into layers of , the closing button is actually in the parent of the containing the code we uploaded, thus a window.parent.mraid.expand() is needed to trigger the expand() properly. This seem really hacky, and I'm wondering if anyone has seen this issue before or has a better solution.
Keep in mind that MRAID format was deprecated from DoubleCLick Studio, it is required to build Mobile-friendly Studio HTML5 format instead.
just want to ask. I've built a reports(SSRS) in ASP.NET(vb). But my problem is, I can't call the javascript in my SSRS to open a new form in ASP.NET, but instead of opening new form I just change to basic show message function. Here's my expression in my textbox in the report ="javascript:test();". The test is a function inside ASP.NET. But when I generate the report, the link in my report doesn't do anything. Is there any problem in my function or in SSRS?
function test(){
alert('Test');
return;
}
I've already have a solution. ="javascript:void(window.showModalDialog('"+ First(Fields!CompanyURL.Value, "SYS_DEFAULTS") + "/logged/dialog_window.aspx?p=master_customers.aspx&objcode=1&recid="& Fields!AccountCode.Value &"'))" but I'm not satisfied because when I mouse over my field. It show the path of my source code. :(
Go to Series chart action properties
="javascript:void(window.parent.test('" + Fields!DeviceStatus.Value+"'))"
And write function Aspx webpages
<script type="text/javascript">
function test(testing) {
alert(testing);
return;
}
</script>
The SSRS report viewer is embedded in an iFrame, so it doesn't have direct visibility to the parent HTML page's functions. You might be able to get to your test function via the following code, but there's no guarantee:
javascript:window.parent.test();
If that doesn't work, then I'd guess you're out of luck. The only other option I can think of is to inline the function body to your javascript: call directly.
Microsoft JScript runtime error: 'txtGivenName_OnFocus' is undefined
After adding what I thought was unrelated javascript code to a web page, I am suddenly getting errors that suggest that the browser cannot locate a javascript function that, to me, appears plain as day in design mode.
I'm thinking that this is a load sequence order problem of some sort. Originally, my script was at the bottom of the page. I did this with the intent of helping my site's SEO ranking.
When I moved the function to the top of the web page, the error went away. Now it is back.
I have a feeling someone is going to suggest a jQuery solution to execute some code only when the page is fully loaded. I'm I ignorant of jQuery. IfjQuery is given in the answer, please explain what I need to do (references, placement of script files) for VS 2010 RTM.
I am trying to set the focus to the first textbox on the webpage and preselect all of the text in the textbox
More info:
If I disable this Validator, the problem goes away:
<asp:CustomValidator ID="valSpecifyOccupation" runat="server" ErrorMessage="Required"
ClientValidationFunction="txtSpecifyOccupation_ClientValidate"
Display="Dynamic" Enabled="False"></asp:CustomValidator>
function txtSpecifyOccupation_ClientValidate(source, args) {
var optOccupationRetired = document.getElementById("<%=optOccupationRetired.ClientID %>");
if (optOccupationRetired.checked) {
args.IsValid = true;
}
else {
var txtSpecifyOccupation = document.getElementById("<%=txtSpecifyOccupation.ClientID %>");
args.IsValid = ValidatorTrim(txtSpecifyOccupation.value) != "";
}
}
Yep, I would say most likely it's a loading order issue as well. And... I would totally recommend jquery...
Wherever you are calling your JavaScript function txtSpecifyOccupation_ClientValidate; I would assume you are possible dynamically writing a script block to the page on load or something...
if this is the case. I would add the following to your generated script block...
$(function() {
... call to function
txtSpecifyOccupation_ClientValidate();
...
});
jquery is very easy to learn. http://docs.jquery.com/Main_Page
I've inherited some code that I need to debug. It isn't working at present. My task is to get it to work. No other requirements have been given to me. No, this isn't homework, this is a maintenance nightmare job.
ASP.Net (Framework 3.5), C#, jQuery 1.4.2. This project makes heavy use of jQuery and AJAX. There is a drop down on a page that, when an item is chosen, is supposed to add that item (it's a user) to an object in the database.
To accomplish this, the previous programmer first, on page load, dynamically loads the entire page through AJAX. To do this, he's got 5 div's, and each one is loaded from a jQuery call to a different full page in the website.
Somehow, the HTML and BODY and all the other stuff is stripped out and the contents of the div are loaded with the content of the aspx page. Which seems incredibly wrong to me since it relies on the browser to magically strip out html, head, body, form tags and merge with the existing html head body form tags.
Also, as the "content" page is returned as a string, the previous programmer has this code running on it before it is appended to the div:
function CleanupResponseText(responseText, uniqueName) {
responseText = responseText.replace("theForm.submit();", "SubmitSubForm(theForm, $(theForm).parent());");
responseText = responseText.replace(new RegExp("theForm", "g"), uniqueName);
responseText = responseText.replace(new RegExp("doPostBack", "g"), "doPostBack" + uniqueName);
return responseText;
}
When the dropdown itself fires it's onchange event, here is the code that gets fired:
function SubmitSubForm(form, container) {
//ShowLoading(container);
$(form).ajaxSubmit( {
url: $(form).attr("action"),
success: function(responseText) {
$(container).html(CleanupResponseText(responseText, form.id));
$("form", container).css("margin-top", "0").css("padding-top", "0");
//HideLoading(container);
}
}
);
}
This blows up in IE, with the message that "Microsoft JScript runtime error: Object doesn't support this property or method" -- which, I think, has to be that $(form).ajaxSubmit method doesn't exist.
What is this code really trying to do? I am so turned around right now that I think my only option is to scrap everything and start over. But I'd rather not do that unless necessary.
Is this code good? Is it working against .Net, and is that why we are having issues?
A google search for
jquery ajax submit
reveals the jQuery Form Plugin. Given that, is that file included on your page where the other code will have access to the method? Does this code work in Firefox and not IE?
Seems like there was too much jQuery fun going on. I completely reworked the entire code block since it was poorly designed in the first place.
I am using the example on the AJAX website for the DropDownExtender. I'm looking to make the target control (the label) have the DropDown image appear always, instead of just when I hover over it.
Is there any way to do this?
This can be done using the following script tag:
<script>
function pageLoad()
{
$find('TextBox1_DropDownExtender')._dropWrapperHoverBehavior_onhover();
$find('TextBox1_DropDownExtender').unhover = VisibleMe;
}
function VisibleMe()
{
$find('TextBox1_DropDownExtender')._dropWrapperHoverBehavior_onhover();
}
</script>
I found this and some other tips at this dot net curry example.
It works but I'd also consider writing a new control based on the drop down extender exposing a property to set the behaviour you want on or off.
Writing a new AJAX control isn't too hard, more fiddly than anything.