Hi,
I have completed this excersie, but i cannot see the results as expected.
It does not display the delete buttom under the pictures within the album.
I am signed in as a Manager role. When I click on Edit Album link. i see the fields where i can upload new pic in the album , and it does not display any existing pics.
Here is my code in Default.aspx in PhotoAlbums Folder
Code:
protected void ListView1_DataBound(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(DropDownList1.SelectedValue))
{
EditLink.NavigateUrl = string.Format("~/ManagePhotoAlbum.aspx?PhotAlbumId={0}", DropDownList1.SelectedValue);
EditLink.Visible = true;
}
else
{
EditLink.Visible = false;
}
Here is the code in ManagePhotAlbum.aspx
I debugged this page by putting a break point on switch statement, and saw that it does not go pass the switch statement, that means the deletebutton visible is not executed at all.
Code:
protected void ListView1_ItemCreated(object sender, ListViewItemEventArgs e)
{
switch (e.Item.ItemType)
{
case ListViewItemType.DataItem:
Button deleteButton = (Button)e.Item.FindControl("DeleteButton");
deleteButton.Visible = Roles.IsUserInRole("Managers");
break;
}
}
Thanks for your help in advance
Suhail