Love the book! Can't believe how much I have learned!
I followed the process outlined on page 546 for hiding a delete button in the gridview - works great. I'm trying to expand on this functionality by applying this same idea when using the ListView control. I see later on page 615 you have accomplished this with a ListView control but use Roles to determine the visiblity of the button. I don't want to use the Roles in my case I just want the same functionality used here - (but using a listview)
Code:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
switch (e.Row.RowType)
{
case DataControlRowType.DataRow:
DataRowView myDataRowView = (DataRowView)e.Row.DataItem;
if (Convert.ToInt32(myDataRowView[âNumberOfReviewsâ]) > 0)
{
LinkButton deleteLink = e.Row.FindControl(âDeleteLinkâ) as LinkButton;
if (deleteLink != null)
{
deleteLink.Enabled = false;
}
}
break;
}
I've gotten this far BUT then don't know how to proceed
Code:
switch (e.Item.ItemType)
{
case ListViewItemType.DataItem:
ListViewItem myItem = (ListViewItem)e.Item.DataItem;