Hello once again,
In the PhotoAlbums/Default.aspx page I have put the hyperlink around user name
Code:
<asp:HyperLink ID="HyperLink2" runat="server"><asp:Label ID="lblUserName" runat="server" Text="" ForeColor="Red" /></asp:HyperLink>
and in code behind I have bound the NavigateUrl property as follows
Code:
HyperLink2.NavigateUrl = "ViewPhotoAlbum.aspx?UserName=" & photoAlbumOwner
Now I wanna create a page ViewPhotoAlbums.aspx such that whenever the uses name is clicked in Default.aspx page then it shows all the pics uploaded by the particular user regardless of the albums that user has.
For this again I am using the ListView to achieve the same.
Code:
<asp:ListView ID="ListView1" runat="server" DataKeyNames="Id"
DataSourceID="LinqDataSource1" onitemcreated="ListView1_ItemCreated">
<LayoutTemplate>
<ul class="itemContainer">
<li ID="itemPlaceholder" runat="server" />
</ul>
</LayoutTemplate>
<ItemTemplate>
<li>
<asp:Image ID="Image1" runat="server" ImageUrl='<%# Eval("ImageUrl") %>' ToolTip='<%# Eval("ToolTip") %>' />
<asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Description") %>' />
<asp:Button ID="DeleteButton" CommandName="Delete" runat="server" Text="Delete" /><br /><br />
</li>
</ItemTemplate>
</asp:ListView>
and the LinqDataSource is modified as follows
Code:
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="DataContext" TableName="Pictures"
Where="UserName == @UserName" EnableDelete="True">
<WhereParameters>
<asp:QueryStringParameter Name="UserName" QueryStringField="UserName"
Type="String" />
</WhereParameters>
</asp:LinqDataSource>
But as UserName is not defined in the table Picture so I get the error
No property or field 'UserName' exists in type 'Picture'
And if I change the table name then Image1, Description etc. will not be accessible. So how we can filter the pics on the basis of
UserName Query String?
Thank You