Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / October 2004

Tip: Looking for answers? Try searching our database.

Custom rendered controls in a DataGrid?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mats-Erik Grundh - 12 Oct 2004 09:56 GMT
Custom rendered controls in a DataGrid?

Is it possible to have a custom control column i a datagrid that render html
(richtext and images) without moving to that column.?

Thanks in advance!
"Jeffrey Tan[MSFT]" - 13 Oct 2004 06:45 GMT
Hi Mats,

First, I want to confirm is your datagrid Winform or web form based?

For Winform datagrid, we usually extend the DataGrid child controls through
override the normal DataGridColumnStyle then add customized child controls
instead of TextBox or checkbox. There is a complete sample can be
downloaded at:
http://www.gotdotnet.com/userfiles/markbou/GridCombo.zip
This sample project nests ComboBox in the datagrid.

"Tailor Your DataGrid Apps Using Table Style and Custom Column Style
Objects"
http://msdn.microsoft.com/msdnmag/issues/03/08/datagrids/

For Web Form, we may use create a TemplateColumn in DataGrid, then add any
control we wanted to the ItemTemplate.

=============================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Mats-Erik Grundh - 13 Oct 2004 10:14 GMT
Thank You Jeffrey!

My question is about Winforms datagrid.

Your nice samples shows how to replace a column to a custom control when you
focus that column(cell) but i want to render (paint) custom columns without
focus a column or cell, like the following sample:

     Row 1 Column one is rich formatted text. Bold and normal. Row 1 Column
two is also rich formatted text. Italic, bold and normal.
     Row 2 Some rich formatted text. Row 2 some rich formatted text.

> Hi Mats,
>
[quoted text clipped - 25 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
Jeffrey Tan - 14 Oct 2004 14:25 GMT
Hi Mats,

Thanks very much for your feedback!

Based on my understanding, you want to add customized control to the normal
cell of DataGrid, not only the current cell in edit mode.

I think your requirement is somewhat like DataGridBoolColumnStyle, which
always show a checkbox in each cell in that column. But I will tell you
that, actually, these checkboxes in the normal cell is not a "true"
checkbox. DataGrid only paints a checkbox image to that cell. There is not
an actual checkbox in that cell.

So ,there is no build-in way to get this done. What we can do is simulate
the DataGridBoolColumnStyle, that is: override DataGridColumnStyle.Paint
method, just draw a control like image to each cell.(Because when every row
cell in a column need to be paint, Paint will be called).

However, painting the richtext content is not an easier job. So I suggest
you change your design to use the standard option, only add the RichTextBox
in current editing mode cell, actually, this is the offical supported way
for DataGridColumnStyle.
=============================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Mats-Erik Grundh - 15 Oct 2004 07:50 GMT
Hi Jeffrey,

I was expecting that answer, but i had a little hope of that some magic
trick would solve my problem.

Thank You for Your Help!

> Hi Mats,
>
[quoted text clipped - 31 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
"Jeffrey Tan[MSFT]" - 18 Oct 2004 10:20 GMT
You are welcome!! If you need further help, please feel free to tell me, I
will help you. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Signature

Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.