I have datasource, say, ds which is bounded to a datagrid, dg.
Assume that ds have 5 columns, c0,c1,c2,c3,c4.
In some case, say, case 1, I want to display columns c0, c1,c2 in dg and use
c3 and c4 in code behind.
In case 2, I want to display column c0, c3, and c4, and use c1 and c2 in
code behind.
Anyone can tell how to do it?
Thanks
David 4 4071
You should be able to access each column's visible property like so:
dgDataGrid.Columns(3).visible = false
--
David Lozzi
Web Applications Developer dlozzi@(remove-this)delphi-ts.com
"david" <da***@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com... I have datasource, say, ds which is bounded to a datagrid, dg. Assume that ds have 5 columns, c0,c1,c2,c3,c4. In some case, say, case 1, I want to display columns c0, c1,c2 in dg and use c3 and c4 in code behind. In case 2, I want to display column c0, c3, and c4, and use c1 and c2 in code behind.
Anyone can tell how to do it?
Thanks
David
David,
Use the datagrid's OnItemDatabound event.
I have some code on my website for adding a checkbox to a datagrid
dynamically that would be a way for you to become familiar with the
OnItemDatabound event. If you'd like to take a look at it you may find it by
using the search box on this page: http://www.aboutfortunate.com?page=codelibrary to search for "Checkbox in
Datagrid"
--
Sincerely,
S. Justin Gengo, MCP
Web Developer / Programmer www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche
"david" <da***@discussions.microsoft.com> wrote in message
news:1A**********************************@microsof t.com... I have datasource, say, ds which is bounded to a datagrid, dg. Assume that ds have 5 columns, c0,c1,c2,c3,c4. In some case, say, case 1, I want to display columns c0, c1,c2 in dg and use c3 and c4 in code behind. In case 2, I want to display column c0, c3, and c4, and use c1 and c2 in code behind.
Anyone can tell how to do it?
Thanks
David
Thank you, David Lozzi and Justin Gengo:
I will try it.
I would be interested in OnItemDatabound event as well, since I did someting
in part which is related to this topic.
David
"S. Justin Gengo" wrote: David,
Use the datagrid's OnItemDatabound event.
I have some code on my website for adding a checkbox to a datagrid dynamically that would be a way for you to become familiar with the OnItemDatabound event. If you'd like to take a look at it you may find it by using the search box on this page: http://www.aboutfortunate.com?page=codelibrary to search for "Checkbox in Datagrid"
-- Sincerely,
S. Justin Gengo, MCP Web Developer / Programmer
www.aboutfortunate.com
"Out of chaos comes order." Nietzsche "david" <da***@discussions.microsoft.com> wrote in message news:1A**********************************@microsof t.com...I have datasource, say, ds which is bounded to a datagrid, dg. Assume that ds have 5 columns, c0,c1,c2,c3,c4. In some case, say, case 1, I want to display columns c0, c1,c2 in dg and use c3 and c4 in code behind. In case 2, I want to display column c0, c3, and c4, and use c1 and c2 in code behind.
Anyone can tell how to do it?
Thanks
David
Hi, David Lozzi:
dgDataGrid.Columns(3).visible = false
is only working for the selected columns in DataGrid Property Builder in
design.
I have tried dgDataGrid.Itemss(3).visible = false. But it does not work.
"David Lozzi" wrote: You should be able to access each column's visible property like so:
dgDataGrid.Columns(3).visible = false -- David Lozzi Web Applications Developer dlozzi@(remove-this)delphi-ts.com "david" <da***@discussions.microsoft.com> wrote in message news:1A**********************************@microsof t.com...I have datasource, say, ds which is bounded to a datagrid, dg. Assume that ds have 5 columns, c0,c1,c2,c3,c4. In some case, say, case 1, I want to display columns c0, c1,c2 in dg and use c3 and c4 in code behind. In case 2, I want to display column c0, c3, and c4, and use c1 and c2 in code behind.
Anyone can tell how to do it?
Thanks
David This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Igor Mendizabal |
last post by:
Hello,
We're doing our own datagrid based on the System.windows.forms.datagrid
control, and are having some problems with horizontal scrolling.
In general, we construct our datagrid adding a...
|
by: Diego TERCERO |
last post by:
Hi...
I'm working on a tool for editing text resources for a family of software
product my company produces.
These text resources are found in a SQL Server database, in a table called...
|
by: Bob |
last post by:
I have a data grid with a template column. Sometimes I
need this column to be read-only, even in edit mode.
Does anyone know how to do this. I get the other columns
by running through the...
|
by: John Ruiz |
last post by:
Greetings,
I originally posted this to
microsoft.public.dotnet.framework.aspnet.datagridcontrol two weeks ago, but
no one was able to answer.
I am unable to dynamically add columns to a...
|
by: Hanson |
last post by:
I have a datagrid control in an aspx page. The datagrid columns will be
dynamically generated according to the pre-page's search condition, I want
to hide some columns in the datagrid. is that...
| |
by: Richard |
last post by:
After printing a userlist to a Datagrid i want some names not to be shown. I
want to know how i can make a entire datagrid row invisible.
I suspect its something with the OnItemDatabound but i am...
|
by: Michael Chong |
last post by:
Hi,
How can I make a column in Datagrid invisible programmatically during
run-time? I did try the following but doesn't work.
DataGridLedger.DataSource = myDataSet
DataGridLedger.DataMember =...
|
by: John Blair |
last post by:
Hi,
Code attached but the line that gives me an error is
MyDataGrid.Columns(2).Visible = False
It actually gives me an error for any value instead of 2 even when 9 bound
columns of data exist....
|
by: david |
last post by:
I have posted my question before. It seems that I can not find the solution.
The question:
I have datasource, say, ds which is bounded to a datagrid, dg.
Assume that ds have 5 columns,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
| |
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...
|
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,...
|
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...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |