I have a bound dropdownlist in which I would like the 'ALL' displayed on page_load. Right now, I have the code setup as a blank and it works like bringing ALL combinations. To make it easier to read for users of my application, I would like to use ALL without coding this functionality in my SQL statements.
strSQL="SELECT StateCD FROM StateCodes Order"
Cmd1=New SqlCommand(strSQL,Conn1)
Conn1.Open()
Rdr1=Cmd1.ExecuteReader()
ddlState.DataSource = Rdr1
ddlState.DataTextField = "StatusCD"
ddlState.DataBind()
ddlState.Items.Insert(0, ""
ddlState.SelectedIndex = 0
Rdr1.close()
[/red]
As you can see, I have a blank as my first index. When the SQL SELECT[/red] is run with this blank, it searches ALL combinations. But when I put ALL[/red] in:
ddlState.Items.Insert(0, "All"
[/red]
I get 0 results returned since it is looking for the word 'ALL', which of course doesn't exist.
So, I would like to know if there is a way to do this.
Your assistance will be greatly appreciated.
strSQL="SELECT StateCD FROM StateCodes Order"
Cmd1=New SqlCommand(strSQL,Conn1)
Conn1.Open()
Rdr1=Cmd1.ExecuteReader()
ddlState.DataSource = Rdr1
ddlState.DataTextField = "StatusCD"
ddlState.DataBind()
ddlState.Items.Insert(0, ""
ddlState.SelectedIndex = 0
Rdr1.close()
[/red]
As you can see, I have a blank as my first index. When the SQL SELECT[/red] is run with this blank, it searches ALL combinations. But when I put ALL[/red] in:
ddlState.Items.Insert(0, "All"
[/red]
I get 0 results returned since it is looking for the word 'ALL', which of course doesn't exist.
So, I would like to know if there is a way to do this.
Your assistance will be greatly appreciated.