I have a datagrid with one column that is boolean (it is a checkbox column).
So that myDataTable.Col umn["myColName"]..DataType.Unde rlyingSystemTyp e ==
System.Boolean. For printing purposes, I would like to change this from a
boolean to a string, so that I may manipulate the output to read "X" instead
of true, and "" for false. If I attempt to change the DataColumn type
currently, I get an error stating that I cannot change the type of a column
when it has already been populated.
So, how can I convert the column type, with data in it, from boolean to
string, so that I can change all "true" to "X" and all "false" to ""?
Oh, and this is a windows application, not asp.net...if it matters in this
case.
TIA
-John E. 1 3421
John E.
Why would you do this? If you are printing the information, then I
would think that you are performing the operations to print yourself. When
rendering the data in that column, just perform a transformation at that
point.
How is it that you are printing the data?
Another option would be to hide the column, and add a new column that
has an expression where the text is X if it is true, a space if it is false
(the value in the corresponding column for that row). Check the Expression
property of the DataColumn class for more information on this.
Hope this helps.
"John E." <pl*********@ne wsgroup.thanks> wrote in message
news:%2******** ********@TK2MSF TNGP12.phx.gbl. .. I have a datagrid with one column that is boolean (it is a checkbox column). So that myDataTable.Col umn["myColName"]..DataType.Unde rlyingSystemTyp e == System.Boolean. For printing purposes, I would like to change this from a boolean to a string, so that I may manipulate the output to read "X" instead of true, and "" for false. If I attempt to change the DataColumn type currently, I get an error stating that I cannot change the type of a column when it has already been populated.
So, how can I convert the column type, with data in it, from boolean to string, so that I can change all "true" to "X" and all "false" to ""?
Oh, and this is a windows application, not asp.net...if it matters in this case.
TIA -John E.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: SoYouKnowBrig |
last post by:
Hi All,
I am using Microsoft.ApplicationBlocks.Cache.CacheManager to persist a
System.Data.Dataset object. This Dataset object has a DataTable that is
created from an existing DataTable using the Clone() method. Before I
add the new DataTable to the DataSet, I change the DataType of a
DataColumn from System.String to System.Int64. I then...
|
by: ad |
last post by:
I use ado.net to fill a Excel wroksheet into a DataTable.
The data in the Excel wroksheet is digital.
After the data filled into the DataTable, the DataType of each column is set
to
Double, but I want to treat them as string, I use the code to covert them
DataTable dt = ds.Tables0];
int iColCount = dt.Columns.Count;
for (int j = 0; j <...
|
by: Mike Lerch |
last post by:
I have a database with 90-odd true-false values that I need to display
on a webform as checkboxes. There are also some other values (numbers
and text) that need to be displayed.
I'm wondering the best way to do this! Do I need to individually
place and databind 90 checkboxes (and label them!) or is there a
better way? Note, this is 90...
|
by: Miguel Dias Moura |
last post by:
Hello,
i know how to hide a table according to a condition:
<table runat="server" visible='<%# dataSetBibliotecas.FieldValue("Titulo",
Container) <> "" %>'...
Now I am trying to change the image file as follows:
- Show the image "yes.gif" if the value of a dynamic field is equal to
"YES";
- Show the image "no.gif" if the value of a...
|
by: Ken McCrory |
last post by:
I have a web form page (.aspx) with 95 label controls that I now need to be
text boxes. Is there an easy way to change those to what I want using
something like a find and replace or am I stuck "changing" each one by hand
by deleting the label and dragging a text box in its place?
Alternatively, the reason I think I need text boxes is that I...
| |
by: Aaron Smith |
last post by:
Ok. I have a dataset that has multiple tables in it. In one of the child
tables, I have a column that I added to the DataSet (Not in the
DataSource). This column does not need to be stored in the data on the
datasource. It simply gets the first name and last name of an instructor
and displays it in the grid. I have two major problems.... One,...
|
by: Bob |
last post by:
I have a CreatedOn field , datetime, which has GetDate() as the default
value in SQL server 2000 table. When I create a new record in the table
itself in enterprise manager, the field gets populated OK, but when I try to
create a new record with a Microsoft datagridview control, I notice that the
datecreated value does not get created. It...
|
by: DaveP |
last post by:
im Trying to set a Datacolumn type for a new table
boolean is not working, What is the correct waty
//column.DataType = System.Type.GetType"System.Data.SqlTypes.SqlBoolean");
column.DataType = System.Type.GetType"System.Boolean"); //"System.Boolean");
tia
|
by: remya1000 |
last post by:
i'm using VB.NET. and its a windows application.
in my program i need to display a table in datagrid. so i created the table using DataTable and i'm calling that dataTable to dataGrid. and its working fine...
but according to one of the field in that table i need to change the back color of that row. one of the field in that table called...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |