-
Formatting datagridview cells after databinding
I have a datagridview in a control. After databinding I want to make some changes to the text of some of the cells. I have tried doing it on cellFormatting and dataBindingComplete both cause a loop. Is there an easy way of doing this?
-
how is the datagridview databound? if it's to a DataTable or DataSet, you can edit those before binding.
If not, then sorry, DataBindingComplete is probably your next option. Unlike the GridView in ASP.Net which allows you to use code to handle each individual row as it's databound, the DataGridView with Windows Programming does not.
Last edited by eclipsed4utoo; 12-16-2008 at 09:06 AM.
-
This is a Windows Forms application and I am binding to a DataTable. The control I have consists of the datagridview and some buttons. The datagridview gets bound to various datatables provided by the form on which the control is used. I was hoping to deal with a particular column in the controls and not have to pre-format the column in the datatable every time I use the control.
The formatting I am doing is stripping out RTF tags. Unfortunately this is not very efficient in SQL.
-
Try switching to an unbound control and load it by programming code at which time you strip out the RTF tags.
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
-
I've done something similar. I do a "for each row" in the datagrid and fix the text. Problem is I have to do this from outside of the control and every time I use the control. I was hoping to build it into the control that it fixed itself as it bound.
-
you can make your own control.
-
I tried to create a custom RTF column but couldn't get it to work. I see there is a new article out regarding this. I was going to review it shortly.
Basically I inherited a textbox column and then I have a function which creates an instance of the RichTextBox, taking the RTF text and returning it as plain text. This would have created a non-formatted but human readable text column. Problem is that the textbox cell leaves enough space for the full RTF text. Once I formatted the cell content, I was left with a chunk of white space at the bottom of each cell.
Similar Threads
-
By Wiseman82 in forum .NET
Replies: 2
Last Post: 05-02-2008, 05:51 PM
-
By jellyfish5000 in forum .NET
Replies: 5
Last Post: 02-23-2007, 05:46 PM
-
By triley35 in forum .NET
Replies: 1
Last Post: 07-08-2006, 12:34 AM
-
By MichaelChoi in forum ASP.NET
Replies: 2
Last Post: 01-15-2003, 07:37 PM
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks