开发者

QueryExtender with dropdown list

i am using QueryExtender with dropdownlist to filter gridview ( datasource : EntityDataSource).

  <asp:SearchExpression SearchType="StartsWith" DataFields="Status" >
    <asp:ControlParameter ControlID="ddlStatus" Type="String"   />
  </asp:SearchExpression>

Where i bind my ddlStatus from database with default value : "Select" But when i run project it takes by default value "Select" for Field "status" and gives empty grid. But on Pageload i want to show all the records after user can select different status from dropdownlist and based on that filter should work.

开发者_运维知识库

how can we show all the data with dropdownlist value selected as default "select"


Just Found solution here in book: Entity Framework 4.0 Recipes: A Problem-Solution Approach

Used PropertyExpression instead of SearchExpression

<asp:PropertyExpression>
    <asp:ControlParameter ControlID="ddlStatus" Type="String"   />
</asp:PropertyExpression>

and leave value blank according to Bala R comment

<asp:ListItem Text="Select" Value="" />


Try using DefaultValue like this

<asp:ListItem Text="Select" Value="Select" />

and

<asp:SearchExpression SearchType="StartsWith" DataFields="Status" >
    <asp:ControlParameter ControlID="ddlStatus" Type="String" Default="Select"  />
 </asp:SearchExpression>
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜