p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Beginning ASP.NET 4 : in C# and VB (http://p2p.wrox.com/forumdisplay.php?f=560)
-   -   Chapter 15 - Hide Delete Button (http://p2p.wrox.com/showthread.php?t=86924)

markmanxp March 8th, 2012 02:25 PM

Chapter 15 - Hide Delete Button
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)


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;

I've gotten this far BUT then don't know how to proceed


switch (e.Item.ItemType)
            case ListViewItemType.DataItem:
          ListViewItem myItem = (ListViewItem)e.Item.DataItem;

Imar March 8th, 2012 03:19 PM

Hi there,


Love the book! Can't believe how much I have learned!
Good to hear. Thanks.

And what exactly are you having problems with? Finding the button? Hiding it? Responding to some event? Can you elaborate and post the code for the control?



All times are GMT -4. The time now is 01:41 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.