Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 4 : in C# and VB
This is the forum to discuss the Wrox book Beginning ASP.NET 4: in C# and VB by Imar Spaanjaars; ISBN: 9780470502211
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 4 : in C# and VB section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 8th, 2012, 02:25 PM
Registered User
 
Join Date: Aug 2011
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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)

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;
 
Old March 8th, 2012, 03:19 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

Quote:
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?

Cheers,

Imar
__________________
Imar Spaanjaars
http://Imar.Spaanjaars.Com
Follow me on Twitter

Author of Beginning ASP.NET 4.5 : in C# and VB, Beginning ASP.NET Web Pages with WebMatrix
and Beginning ASP.NET 4 : in C# and VB.
Did this post help you? Click the button below this post to show your appreciation!





Similar Threads
Thread Thread Starter Forum Replies Last Post
php/mysql delete button and delete query dungey PHP Databases 17 April 11th, 2009 12:24 PM
Chapter 13 4th Try It Out Delete Button Error jee26 BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 7 September 7th, 2008 08:24 AM
Hide button image aware Javascript How-To 2 September 26th, 2006 05:34 PM
disable the hide button in the pivot menu paul20091968 Excel VBA 0 June 29th, 2006 08:59 AM
hide the Start button in Win NT [email protected] Visual C++ 0 October 15th, 2003 09:35 AM





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