Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 7th, 2006, 10:08 PM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default GridView.SelectedIndex Prop

Hi Gang,

This has me stumpted. I am re-writing ManageCategories.aspx and one of the changes I am making is I am using the regular asp:ImageButton for editing a category instead of the asp:CommandField which Marco uses.

When you use the CommandField control you can select the current row in the GridView by setting the ShowSelectButton prop of the CommandField control so when you click it, the row is selected and the DetailsView control knows which category to show and everything works well.

The ImageButton has no such prop. In the event handler of the button, I need to get the proper index so I can select the row and run the line that puts the DetailsView in edit mode. But I can't figure out how to do that. The sender param of the event handler is the button itself.

I could make an AddEditCategory page and do the editing from there (sending the ID of the current Category) but I like Marco's layout and I want to keep it if possible. Please help.

Thanks.

Steve



  #2 (permalink)  
Old October 8th, 2006, 10:55 AM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default


Hi,

I've decided to quit trying to use the regular controls and stick with the ones Marco uses. The reason I wanted to make the change is because, with the controls Marco uses, there is a fairly wide margin between the buttons as they line up horizontally and I could not figure out how to bring them together so they appear like a tool bar. I have tried to set the cellspacing prop of the gridview to 0 and other things but the gap remains. In design view, the controls appear in their cells with no gap but the gap is there in runtime. Anyone know how to fix this?

If I can't figure it out, I will add a gap to the regular buttons that appear elsewhere in the application to make it look uniform. But it looks kind of clunky.

Thanks

Steve

  #3 (permalink)  
Old October 8th, 2006, 09:08 PM
Authorized User
 
Join Date: Aug 2006
Location: , , .
Posts: 16
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The solution is not to use the command buttons but to use the generic buttons instead. They group better. You can put them into a template and position them easily. My problem was that I could not get Marco's Edit button to work because I could not find out how to get the row index in order to programmatically select it. However I discovered that you can make an edit button that will automatically select its row with no code. All you have to do is set the button's CommandName prop to 'Select'. That's it.


 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SelectedIndex in datalist dhoward VB.NET 2002/2003 Basics 0 August 28th, 2008 10:15 AM
Databinding the ImageURL Prop of an Image Control Aaron Edwards ASP.NET 2.0 Professional 1 November 22nd, 2007 12:53 PM
Use of Attributes prop.ty for a OOXML node Gianni Giaccaglini Excel VBA 1 September 24th, 2007 05:05 AM
detailsview.pageindex = gridview.selectedindex yukijocelyn ASP.NET 2.0 Basics 2 September 11th, 2007 08:36 PM
move next rows in DataGrid < > prop. not correct fbailey ASP.NET 1.0 and 1.1 Basics 3 September 5th, 2007 10:17 AM



All times are GMT -4. The time now is 05:53 AM.


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