help..how在下拉列表项的基础上显示dataList视图中的数据 [英] help..how to show data in dataList view on the basis of dropdown-list items

查看:69
本文介绍了help..how在下拉列表项的基础上显示dataList视图中的数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,



i想在下拉菜单中根据所选项目在数据列表视图中显示我的数据..



i已将数据与我的数据列表视图绑定,它显示除图像之外的所有数据列..



我应该如何显示我的图像数据来自数据库以及..根据所选项目从下拉列表它应该响应,但它没有显示任何响应..



i没有使用这背后的任何代码..我在向导的帮助下生成查询并使用我的数据库绑定特定数据,并将数据显示到其各自的控件..



如果有人已完成相关工作..请评论出来



谢谢..



这是我的代码到目前为止::

  <   span     class   =  auto-style2 > 我想看看: <   / span  >    <   asp:DropDownList     ID   =  DropDownList1    runat   =  server   高度  =  44px   宽度  =  214px    OnSelectedIndexChanged   =  DropDownList1_SelectedIndexChanged    CssClass   =  auto-style3    DataTextField   = 品牌    DataValueField   = 品牌 >  
< asp:ListItem 已选择 = True > 衣服
< asp:ListItem > 珠宝
< asp:ListItem > shoes

< asp:DataList < span class =code-attribute> ID = DataList1 runat = server RepeatColumns = 3 RepeatDirection = 水平

宽度 = 99% BorderColor = 蓝色 BorderStyle = 实体 BorderWidth = 3px DataSourceID = SqlD ataSource1 高度 = 456px >
< itemtemplate >
品牌:
< asp:标签 ID = BrandLabel runat = server < span class =code-attribute> 文本 =' <% #Eval( 品牌)%>' > ;
< br / > < br / >
图片:< br / >
< br / >
< asp:图像 ID = Image1 runat = server ImageUrl =' <% #Eval( 图像)%> ' / > < br / > < br / >
价格:
< asp:标签 ID = PriceLabel runat = server 文本 =' <% #Eval( Price)%>' / >
< br / > < br / >
描述:
< asp:标签 ID = DescriptionLabel runat = < span class =code-keyword> server 文本 =' <% #Eval( 描述)%>' / >
< br / > < br / >
< / itemtemplate >
< item style horizo​​ntalalign = 中心 verticalalign = Top / >
< span class =code-keyword>< asp:SqlDataSource ID = SqlDataSource1 runat = server ConnectionString = < span class =code-keyword> <% $ ConnectionStrings:loginString%> SelectCommand = SELECT [品牌],[价格],[图片],[说明] FROM [w_product] WHERE([Category] ​​= @Category) >
< SelectParameters >
< asp: ControlParameter ControlID = DropDownList1 DefaultValue = 衣服 姓名 = 类别 PropertyName = SelectedValue 类型 = 字符串 / >
< / SelectParameters >

解决方案

ConnectionStrings:loginString%> SelectCommand = SELECT [Brand] ,[价格],[图片],[描述] FROM [w_product] WHERE([Ca] tegory] ​​= @Category) >
< SelectParameters >
< asp:ControlParameter ControlID = DropDownList1 DefaultValue = 衣服 名称 = 类别 PropertyName = SelectedValue 类型 = 字符串 / >
< / SelectParameters >


hello,

i want to show my data in data list view on the basis of selected item from drop down menu..

i have bonded the data with my data list view its showing all the data columns except the image ..

how should i display my image data from db as well .. on the basis of selected item from drop down it should respond but its not showing any response..

i didnt use any code behind this all.. i have it by the help of wizard to generate queries and bind specific data with my db, and show data to its respective controls..

if someone has done related work .. please comment out

thanks..

this is my code so far::

<span class="auto-style2">I wanna see: </span> <asp:DropDownList ID="DropDownList1" runat="server" Height="44px" Width="214px" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" CssClass="auto-style3" DataTextField="Brand" DataValueField="Brand">
            <asp:ListItem Selected="True">clothes
            <asp:ListItem>jewelry
            <asp:ListItem>shoes
        
        <asp:DataList ID="DataList1" runat="server" RepeatColumns="3" RepeatDirection="Horizontal"

   Width="99%" BorderColor="Blue" BorderStyle="Solid" BorderWidth="3px" DataSourceID="SqlDataSource1" Height="456px">
            <itemtemplate>
                Brand:
                <asp:Label ID="BrandLabel" runat="server" Text='<%# Eval("Brand") %>'>
                <br /><br />
                Image:<br />
                <br />
 <asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("Image") %>' /><br /><br />
                Price:
                <asp:Label ID="PriceLabel" runat="server" Text='<%# Eval("Price") %>' />
                <br /><br />
                Description:
                <asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' />               
                <br /><br />
            </itemtemplate>
            <itemstyle horizontalalign="Center" verticalalign="Top" />        
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:loginString %>" SelectCommand="SELECT [Brand], [Price], [Image], [Description] FROM [w_product] WHERE ([Category] = @Category)">
            <SelectParameters>
                <asp:ControlParameter ControlID="DropDownList1" DefaultValue="clothes" Name="Category" PropertyName="SelectedValue" Type="String" />
            </SelectParameters>

解决方案

ConnectionStrings:loginString %>" SelectCommand="SELECT [Brand], [Price], [Image], [Description] FROM [w_product] WHERE ([Category] = @Category)"> <SelectParameters> <asp:ControlParameter ControlID="DropDownList1" DefaultValue="clothes" Name="Category" PropertyName="SelectedValue" Type="String" /> </SelectParameters>


这篇关于help..how在下拉列表项的基础上显示dataList视图中的数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆