我有单选按钮列表。 asp代码:
Auditing: <asp:RadioButtonList ID="RBLAudit" runat="server" Font-Bold="true" RepeatDirection="Horizontal" RepeatLayout="Flow" TextAlign="Left">
<asp:ListItem Value="true" Text=" Audited" Selected="True"/>
<asp:ListItem Value="false" Text=" Not Audited "/>
<asp:ListItem Value="" Text="ALL"/>
</asp:RadioButtonList>
我有RDLC报告,布尔参数如下:
我想在选择单选按钮列表的ALL选项时传递空值。 我试试这个代码
If (RBLAudit.SelectedValue <> "") Then
p9 = New ReportParameter("State", RBLAudit.SelectedValue)
ElseIf (RBLAudit.SelectedValue = "") Then
p9 = New ReportParameter("State", DBNull.Value.ToString())
End If
Dim RepParams() As ReportParameter = {p1, p2, p3, p4, p5, p6, p7, p8, p9}
但RBLAudit.SelectedValue = ""
时这不起作用。错误为"The value provided for the report parameter 'State' is not valid for its type."
如何为此布尔参数传递空值?
答案 0 :(得分:0)
最后它在非常努力和失败之后起作用......
If (RBLAudit.SelectedValue <> "") Then
p9 = New ReportParameter("State", RBLAudit.SelectedValue)
ElseIf (RBLAudit.SelectedValue = "") Then
p9 = New ReportParameter("State", New String() {Nothing})
End If
还有其他想法吗?