Click here to Skip to main content
15,891,529 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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::
HTML
<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>
Posted
Updated 10-Jan-15 16:57pm
v3
Comments
Kornfeld Eliyahu Peter 11-Jan-15 2:45am    
What is the value of the Image column in the DB?
Did you checked the final (client-side) value of it with your browser's debugger?
kashyapa78 12-Jan-15 1:26am    
What is the data type of the image in your database ... in you code you are setting ImageUrl='<%# Eval("Image")%>' ... this will work only when you have stored image as a string with value equal to something like "http://someserver.com/images/1.png" ?? If you have stored the image as a binary this wont work ... you will need a httphandler which can actually read your image and send back a binary stream which can be set to your imageurl...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900