📄 webbehavior.aspx
字号:
<%@ Page language="c#" Codebehind="WebBehavior.aspx.cs" AutoEventWireup="false" Inherits="AWC.Reporter.Web.WebBehavior" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>Web Behavior</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<STYLE type="text/css">BODY { BACKGROUND: #fbfbfb; FONT-FAMILY: Verdana }
A:link { COLOR: blue; TEXT-DECORATION: none }
A:active { COLOR: red; TEXT-DECORATION: none }
A:visited { COLOR: blue; TEXT-DECORATION: none }
</STYLE>
<script language="javascript">
<!--
var objCall;
// to decode the result from base64
function charFromCharCode (charCode) {
return unescape('%' + charCode.toString(16));
}
function decode (encStr) {
var charCodes = new Array();
var decStr = "";
/* charCodes contains the index values into the base64 array
for each character in the encoded string */
for (var i = 0; i < encStr.length; i++)
decStr += charFromCharCode(encStr[i]);
return decStr;
}
// call the Render method
function runReport()
{
var optional;
var objCall = proxy.createCallOptions();
//objCall.asynch = false;
// Define the web method
objCall.funcName = "Render";
// Define the Array
objCall.params = new Array();
objCall.params.Report = frmReports.drpReports.value;
objCall.params.Format = "XML";
objCall.params.HistoryID = optional;
objCall.params.DeviceInfo = optional;
objCall.params.Credentials = optional;
objCall.params.ShowHideToggle = optional;
objCall.params.Endcoding = optional;
objCall.params.MimeType = optional;
objCall.params.ParameterUsed = optional;
objCall.params.Warnings = optional;
objCall.params.StreadIds = optional;
var parameters = frmReports.txtParameter;
if (parameters)
{
objCall.params.Parameters = getParameters(parameters)
}
proxy.RS.callService (fnHandler, objCall);
}
// initialize the proxy
function init()
{
proxy.useService("http://192.168.1.204/reportserver/reportservice.asmx?WSDL","RS");
}
// to hold the parameter values
function parameter() {
this.Name = null;
this.Value = null;
return true;
}
// populate the report parameters
function getParameters(parameters)
{
reportParams = new Array();
// iterate over the parameters
for (i=0;i<parameters.length;i++) {
var newParam = new parameter();
newParam.Name = parameters[i].name;
newParam.Value = parameters[i].value;
reportParams[i] = newParam;
}
return reportParams;
}
// the callback function to be called when the report is ready
function fnHandler(res)
{
if (!res.error)
{
var decodedResult = decode(res.value.Result);
OpenReport (decodedResult);
}
else
{
alert(res.errorDetail.string);
}
}
// save the report payload to a disk file
// and shell out to it
function OpenReport(reportPayload)
{
var fso, f, r
var ForReading = 1, ForWriting = 2;
fso = new ActiveXObject("Scripting.FileSystemObject")
f = fso.OpenTextFile("c:\\report.xml", ForWriting, true)
f.Write(reportPayload);
f.Close();
window.open("c:\\report.xml", "_blank", "location=no,toolbar=no,left=100,top=100,height=600,width=800");
}
//-->
</script>
</HEAD>
<body onload="init()" MS_POSITIONING="FlowLayout">
<form id="frmReports" method="post" runat="server">
<h3 align="center"><FONT face="Verdana" color="#476789">Using the Web Behavior</FONT></h3>
<table id="tblWriteBack" style="BORDER-RIGHT: tan 1px solid; BORDER-TOP: tan 1px solid; FONT-SIZE: 8pt; BORDER-LEFT: tan 1px solid; WIDTH: 300px; BORDER-BOTTOM: tan 1px solid; FONT-FAMILY: Verdana; BORDER-COLLAPSE: collapse; BACKGROUND-COLOR: white"
borderColor="tan" cellSpacing="0" cellPadding="2" width="300" align="center" border="1">
<tr style="FONT-WEIGHT: bold; COLOR: darkslateblue; BACKGROUND-COLOR: beige">
<td style="HEIGHT: 12px" colSpan="2">Choose Report</td>
</tr>
<tr style="COLOR: darkslateblue; BACKGROUND-COLOR: beige">
<td style="WIDTH: 80px; HEIGHT: 23px" noWrap>Reports:</td>
<td style="HEIGHT: 23px" noWrap><asp:dropdownlist id="drpReports" runat="server" AutoPostBack="True"></asp:dropdownlist></td>
</tr>
<tr style="FONT-WEIGHT: bold; COLOR: darkslateblue">
<td style="HEIGHT: 12px" colSpan="2">Parameters</td>
</tr>
<tr style="COLOR: darkslateblue; BACKGROUND-COLOR: beige">
<td width="300" colSpan="2"><asp:datagrid id="grdParams" runat="server" BorderStyle="Solid" width="300px" NAME="grdOrders"
Font-Name="Verdana" Font-Size="8pt" AllowSorting="True" font-names="Verdana" AutoGenerateColumns="False" BackColor="White"
BorderWidth="1px" BorderColor="Tan" CellPadding="2" EnableViewState="False">
<AlternatingItemStyle BackColor="Beige"></AlternatingItemStyle>
<ItemStyle ForeColor="DarkSlateBlue"></ItemStyle>
<HeaderStyle Font-Bold="True" ForeColor="White" BackColor="DarkRed"></HeaderStyle>
<Columns>
<asp:BoundColumn DataField="Name" ReadOnly="True" HeaderText="Name">
<HeaderStyle Width="80px"></HeaderStyle>
<ItemStyle Wrap="False"></ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Value">
<HeaderStyle HorizontalAlign="Center" Width="70px"></HeaderStyle>
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<input type=text id="txtParameter" name='<%# DataBinder.Eval(Container.DataItem,"Name").ToString()%>' value='<%# DataBinder.Eval(Container.DataItem,"Value").ToString()%>'>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
<PagerStyle Mode="NumericPages"></PagerStyle>
</asp:datagrid></td>
</tr>
<tr style="FONT-WEIGHT: bold; COLOR: darkslateblue">
<td style="HEIGHT: 12px" colSpan="2"><A onclick="runReport();" href="#">Run Report</A></td>
</tr>
</table>
</form>
<div id="proxy" style="BEHAVIOR: url(webservice.htc)"></div>
</body>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -