在page_load中我这样写的:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
Dim myList As New ArrayList()
myList.Add("全部")
myList.Add("焦点")
isfocus.DataSource = myList
isfocus.DataBind()
End If
End Sub
<asp:DropDownList id="isfocus" runat="server">
<asp:ListItem Value="all">全部</asp:ListItem>
<asp:ListItem Value="1">焦点</asp:ListItem>
</asp:DropDownList>
我是这样写的取dropdownlist中的值语句:focus=isfocus.selecteditem.value
我是想通过选取“焦点”字段而达到找到数据库中的1,但是取值时还是取到的是焦点 select * from app_project where c_focus=focus order by c_id desc
我想要达到:select * from app_project where c_focus=1 order by c_id desc的效果。该怎么办呀????
你写的好象没问题的
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not IsPostBack Then
isfocus.items.add(new listitem("全部","all"))
isfocus.items.add(new listitem("焦点","l")
End If
End Sub
no need to databind, you already explicitly specify the values.