Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

General Advice

Posted on 2004-08-22
7
Medium Priority
?
222 Views
Last Modified: 2010-04-15
I'm an asp/asp.net developer and new to windows forms development.

I want to know the best way to display a list of data - columsn and rows with some columns containing a button which I can attached some event to.

I have been looking at using the datagrid for this but it seems very hard to get buttons in there which makes me think for such a common task I must be using tht wrong concept.

Any thoughts?

Thanks

Dave
0
Comment
Question by:daveamour
  • 4
  • 2
7 Comments
 
LVL 10

Expert Comment

by:eternal_21
ID: 11864817
I prefer the ListView to the DataGrid for displaying a single relation.  Instead of having a button, you can respond to the ListView.DoubleClick event.
0
 
LVL 19

Author Comment

by:daveamour
ID: 11864847
Will this work with rows having more than 1 column?  This is what I need.

Thanks

Dave
0
 
LVL 10

Accepted Solution

by:
eternal_21 earned 150 total points
ID: 11865529
Yes, the ListView can have multiple columns.  It looks like Windows Explorer when you are in View -> Details mode.
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 19

Author Comment

by:daveamour
ID: 11867431
Oh ok thats interesting.  Can this have columns with buttons in too?

Dave
0
 

Expert Comment

by:DamonCarr
ID: 11870820
Here are the type of coluumns officially supported by the DataGrid:


Bound column Allows you to specify which data source field to display. Allows you to specify the format of that field, using a .NET formatting expression.  

Hyperlink column Displays information as hyperlinks. A typical use is to display data (such as a customer number or product name) as a hyperlink that users can click to navigate to a separate page that provides details about that item.  

Button column Allows you to add a button for each item in the grid and define custom functionality for that button. For example, you might create a button labeled "Add to Shopping Cart" that runs your custom logic when a user clicks it. You can also add predefined buttons for Select, Edit, Update, Cancel, and Delete functions.  

Edit, Update, Cancel column Allows you to create in-place editing. For more details, see "Editing Items" below.

Template column Allows you to create combinations of HTML text and server controls to design a custom layout for a column. The controls within a template column can be data-bound. Template columns give you great flexibility in defining the layout and functionality of the grid contents, because you have complete control over how the data is displayed and what happens when users interact with rows in the grid.  


There are implementations of a DropDownList you can find on the INternat as a Template Column.

Overall the DataGrid can do some very powerful things. See MSDN and Search on DataGrid for a number of excellent columns:

msdn.microsoft.com

And take the advice in my BLOG. It discussed what you need to do explicitly. It is here:

http://agiledamon.blogspot.com/

You need MSDN and Safari (at a minimim).

Kind Regards,
Damon Wilder Carr, Chief Technologist and CEO
.NET SIG Leader - New York Software Industry Association (NYSIA www.nysia.org)

agilefactor
80 Broad Street
5th Floor
New York, NY 10004

Voice              212.837.7788
Fax                212.859.7359

http://www.agilefactor.com/ 
http://agiledamon.blogspot.com/
0
 
LVL 19

Author Comment

by:daveamour
ID: 11870875
Damon - are you talkking about the DataGrid used in asp.net.  I believe that this is quite different from the one used in Windows Forms which is what we are discussing here!
0
 
LVL 19

Author Comment

by:daveamour
ID: 11878813
Thanks eternal
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
High user turnover can cause old/redundant user data to consume valuable space. UserResourceCleanup was developed to address this by automatically deleting user folders when the user account is deleted.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
Suggested Courses
Course of the Month12 days, 18 hours left to enroll

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question