开发者

Photo Album in asp.net

开发者 https://www.devze.com 2023-02-04 03:24 出处:网络
i am working visual studio 2008 with database as sql server 2005 i need to create a photo album i used listview control to display data

i am working visual studio 2008 with database as sql server 2005 i need to create a photo album i used listview control to display data

my table contains :> Email_Id title description Image

i used generic handler to convert binary data into image

now the main problem is when i upload photo it is uploaded to my database properly but when i try to display the image the first image with Email_Id is only shown in listview controls

     <asp:ListView ID="ListView1" runat="server" GroupItemCount="4" 
                    DataSourceID="SqlDataSource1" DataKeyNames="Email_Id">
                <LayoutTemplate>
                        <asp开发者_JS百科:Placeholder
                        id="groupPlaceholder"
                        runat="server" />
                    </LayoutTemplate>
                    <GroupTemplate>
                        <div>
                        <asp:Placeholder
                        id="itemPlaceholder"
                        runat="server" />
                        </div>
                    </GroupTemplate>
                    <ItemTemplate>
                    <div style="font-size:medium;">
          <asp:Image id="picAlbum" runat="server" width="150px" Height="200px"
             ImageUrl='<%# "~/PHandler.ashx?Email_Id=" + Eval("Email_Id") %>' />
                        </div>
                    </ItemTemplate>
                    <EmptyItemTemplate>            

                    </EmptyItemTemplate>
                </asp:ListView>
                <br />
                <br />
                <br />

" SelectCommand="SELECT [Email_Id], [Title], [Description], [Image] FROM [Picture_album] WHERE ([Email_Id] = @Email_Id)">

can any one help me out i want to show all the image uploaded by the specific email_id in my photo ablum


Phandler.ashx is only getting email_id. You will need to give it more to know which image to load. Alter your table to include a uniqueiidentifier or timestamp field and pass that to you handler instead. Also you should not be selecting the image field from this page as the handler should be doing that.

0

精彩评论

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

关注公众号