Here's my radiobuttonlist:
<asp:RadioButtonList ID="Pending" runat="server" AutoPostBack="True" OnSelectedIndexChanged="Populategrid">
<asp:ListItem Value="250">Over 250</asp:ListItem>
<asp:ListItem Value="300">Over 300</asp:ListItem>
<asp:ListItem Value="350">Over 350</asp:ListItem>
<asp:ListItem Value="400">Over 400</asp:ListItem>
</asp:RadioButtonList>
I have a gridview set up to bring in all of the items listed in the radiobuttonlist. When the page loads the first time it comes in as showing Over 250 only:
Private Sub GridView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.DataBound
GridView1.Columns(2).Visible = False
GridView1.Columns(3).Visible = False
GridView1.Columns(4).Visible = False End Sub
This is the code behind:
Protected Sub PopulateGrid(ByVal sender As Object, ByVal e As EventArgs)
'Select Case Pending.SelectedItem.Value ' Case "300"
Dim conn As New Data.SqlClient.SqlConnection(ConfigurationManager.ConnectionStrings("PendingClaimsConnectionString").ConnectionString)
Dim cmd As New Data.SqlClient.SqlCommand
Dim cmdPending As New Data.SqlClient.SqlCommand With cmdPending
.CommandType = Data.CommandType.StoredProcedure
.CommandText = "GetRangeofDDSPend" .Connection = conn
If Pending.SelectedValue = "300" And .Parameters.AddWithValue("@doc", Request.QueryString("doc")) Then
GridView1.Columns(2).Visible = False
GridView1.Columns(3).Visible = True
GridView1.Columns(4).Visible = False End If
'.Parameters.AddWithValue("@doc", Request.QueryString("doc"))
'.Parameters.AddWithValue("@doc", Pending.SelectedValue)
End With
Dim adapter As New Data.SqlClient.SqlDataAdapter(cmdPending) Try
conn.Open() Dim ds As New Data.DataSet
adapter.Fill(ds) 'GridView1.DataSource = ds
GridView1.DataBind() Finally conn.Dispose()
End Try End Sub
I'm getting an error under the If pending.selected value = "300" and .Parameters.AddWithValue etc...
saying operator AND is not defined for types Boolean
What am I doing wrong?
Here's the stored procedure:
if @doc ='F03'begin
select doc, [250]=SUM([250]), [300]=SUM([300]), [350]=SUM([350]), [400]=SUM([400])
from ( SELECT doc,
[250] = case when [Days] > 250 then cnt else 0 end,
[300] = case when [days] > 300 then cnt else 0 end,
[350] = case when [days] > 350 then cnt else 0 end,
[400] = case when [days] > 400 then cnt else 0 end from (
SELECT doc, cnt=COUNT(*),
[days]=Datediff(Day, filedate, Getdate()) FROM pendingdds p
join Offices.dbo.OfficeCodes d on d.officecode = p.doc
WHERE d.typecode='7' and d.reportsto='F03'
group by doc, Datediff(Day, filedate, Getdate()) ) as a)as b
group by doc
end