使用URL中的下拉列表值

时间:2017-02-09 18:41:17

标签: asp.net ssrs-2008

我有一个页面,用户可以选择日期范围,名称和表单类型(A,B,E,T)。在此基础上,我使用结果填充网格并超链接报告编号。当用户单击报告编号时,将显示报告。如何将下拉列表选定值插入URL以根据用户选择的报告类型获取正确的报告?如果用户选择表单A,则SSRS的URL应从SSRS调用格式报告,依此类推。

标记

<body>
 <link href="StyleSheet.css" rel="stylesheet" />
<form id="form1" runat="server">
<div>
<center><h1>Custom Reporting<br />
    Pick a date range, an Inspector, and the type of inspection to list:</h1>
    <p>Note - Date range is the dates of inspection, not dates of data input</p><br />
    Start date: <asp:TextBox ID="stdt" runat="server"></asp:TextBox><asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ControlToValidate="stdt" ErrorMessage="mm/dd/yyyy" ValidationExpression="^((0?[13578]|10|12)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1}))|(0?[2469]|11)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1})))$" Display="Dynamic"></asp:RegularExpressionValidator> End date: <asp:TextBox ID="enddt" runat="server">
        </asp:TextBox>
    <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="enddt" ErrorMessage="mm/dd/yyyy" ValidationExpression="^((0?[13578]|10|12)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[01]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1}))|(0?[2469]|11)(-|\/)(([1-9])|(0[1-9])|([12])([0-9]?)|(3[0]?))(-|\/)((19)([2-9])(\d{1})|(20)([01])(\d{1})|([8901])(\d{1})))$" Display="Dynamic"></asp:RegularExpressionValidator> Inspector: <asp:DropDownList ID="DDLInsp" runat="server" DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="Name">
    </asp:DropDownList> 
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ESDFormsConnectionString %>" SelectCommand="SELECT [Name] FROM [Inspectors] ORDER BY [Name]"></asp:SqlDataSource>
    Inspection Type: <asp:DropDownList ID="DDLType" runat="server">
        <asp:ListItem>Form A</asp:ListItem>
        <asp:ListItem>Form B</asp:ListItem>
        <asp:ListItem>Form E</asp:ListItem>
        <asp:ListItem>Form T</asp:ListItem>
        <asp:ListItem Selected="True">Pick One</asp:ListItem>
    </asp:DropDownList>
    <br />
    <br />
    <asp:Button ID="btnFind" runat="server" Text="Find Reports" />
    <br />
    </center>
</div>
    <br />
<center>
    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" EmptyDataText="No records found" BackColor="White" BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical">
        <AlternatingRowStyle BackColor="#DCDCDC" />
        <Columns>
            <asp:BoundField DataField="enddt" HeaderText ="Date" DataFormatString="{0:d}" />
            <asp:HyperlinkField HeaderText="Report Number" DataTextField="rptnum" DataNavigateURLFields="rptnum" DataNavigateurlformatstring="http://servername/ReportServer?/esdforms/THE REPORT TITLE SHOULD GO HERE&rs:Command=Render&rc:Parameters=False&rptnum={0}" />
        </Columns>
        <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
        <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
        <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
        <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
        <SortedAscendingCellStyle BackColor="#F1F1F1" />
        <SortedAscendingHeaderStyle BackColor="#0000A9" />
        <SortedDescendingCellStyle BackColor="#CAC9C9" />
        <SortedDescendingHeaderStyle BackColor="#000065" />
    </asp:GridView></center>

</form>

0 个答案:

没有答案