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, 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.
The following Possible solution do not work:
dg.Column(3).Visible = false.
My analysis from the test: dg.Column(3).Visible = false is only working for
those columns which are defined in design by DataGrid Property Builder. If
you populate a table to the datagrid via binding programmatically, it does
not work, at least in my computer.
Any good solution for it?
Thanks
David 3 1839
Hi David,
The Column.Visible property works on both declaratively and dynamically
created DataGrid controls. To prove it, I put in this demo http://www.societopia.net/Samples/Da...Delegates.aspx an experiment
in hiding/displaying columns with a dynamically created DataGrid.
--
HTH,
Phillip Williams http://www.societopia.net http://www.webswapp.com
"david" wrote: 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, 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.
The following Possible solution do not work: dg.Column(3).Visible = false.
My analysis from the test: dg.Column(3).Visible = false is only working for those columns which are defined in design by DataGrid Property Builder. If you populate a table to the datagrid via binding programmatically, it does not work, at least in my computer.
Any good solution for it?
Thanks
David
I have played your example. It is a very good example to help me for other
checkbox control of cell in a datagrid. I will check your code.
By the way, when you drag the datagrid from toolbox, have you unchecked any
property for it?
Thanks
David
"Phillip Williams" wrote: Hi David,
The Column.Visible property works on both declaratively and dynamically created DataGrid controls. To prove it, I put in this demo http://www.societopia.net/Samples/Da...Delegates.aspx an experiment in hiding/displaying columns with a dynamically created DataGrid.
-- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"david" wrote:
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, 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.
The following Possible solution do not work: dg.Column(3).Visible = false.
My analysis from the test: dg.Column(3).Visible = false is only working for those columns which are defined in design by DataGrid Property Builder. If you populate a table to the datagrid via binding programmatically, it does not work, at least in my computer.
Any good solution for it?
Thanks
David
Hi David,
The example whose link I provided below was not created using the VS.Net
toolbox at all. It is done using a notepad. The controls are created
dynamically (not placed declaratively on the web form). If you want another
sample that is done declaratively (i.e. you can recreate using the VS.Net)
review this one http://www.societopia.net/Samples/Da...olsEvents.aspx
--
HTH,
Phillip Williams http://www.societopia.net http://www.webswapp.com
"david" wrote: I have played your example. It is a very good example to help me for other checkbox control of cell in a datagrid. I will check your code.
By the way, when you drag the datagrid from toolbox, have you unchecked any property for it?
Thanks
David
"Phillip Williams" wrote:
Hi David,
The Column.Visible property works on both declaratively and dynamically created DataGrid controls. To prove it, I put in this demo http://www.societopia.net/Samples/Da...Delegates.aspx an experiment in hiding/displaying columns with a dynamically created DataGrid.
-- HTH, Phillip Williams http://www.societopia.net http://www.webswapp.com
"david" wrote:
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, 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.
The following Possible solution do not work: dg.Column(3).Visible = false.
My analysis from the test: dg.Column(3).Visible = false is only working for those columns which are defined in design by DataGrid Property Builder. If you populate a table to the datagrid via binding programmatically, it does not work, at least in my computer.
Any good solution for 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 tablestyle and
gridcolumnstyles to that tablestyle. If we have invisible columns, we add
the gridcolumnstyle with Width = 0 (couldn't find any other...
|
by: Laertes |
last post by:
HI,
is it there a possibility of selecting which fields to have visible on
a form?
Up to now I've setup another form which has true/false toggles (one
for each field in question) on which I select which fields I want
visible. Then when I open the form in question the "openform"
subroutine checks which toggles have true values and sets the...
|
by: Susan Bricker |
last post by:
Greetings. I have three forms that are open at the same time. They are
related and cascading. The first form (frmEventAdd) is the anchor. Each
event can have many Trials. The second form is frmTrialInfo. Each Trial
can have three Classes. The third form is frmClassInfo. These forms are
used for update and adding new records.
The user...
|
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 kinda stuck there.
but this is basicly what i want.
if Username = "Deleted_User" then
'make entire table row invisible.
End if
|
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 = "ParentTable"
DataGridLedger.DataBind()
DataGridLedger.Visible = True
DataGridLedger.Columns(1).Visible = False
| |
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. How do i hide a column? Thanks.
MyConnection = New
SqlConnection("server=(local);database=pubs;Trusted_Connection=yes")
MyCommand = New...
|
by: david |
last post by:
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
|
by: scottyman |
last post by:
I can't make this script work properly. I've gone as far as I can with
it and the rest is out of my ability. I can do some html editing but
I'm lost in the Java world. The script at the bottom of the html page
controls the form fields that are required. It doesn't function like
it's supposed to and I can leave all the fields blank and it still...
|
by: ghat12 |
last post by:
Hi,
I am trying to print a subform containing approx 50 columns in
datasheet view. The printout cannot fit more than 8-10 columns. Does
anyone know of any way to print all columns; i don't care if the
printout spans multiple pages.
FYI, the records displayed in the sub-form are dynamically obtained
based on some ad-hoc querying in the...
|
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: 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: 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: 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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
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
| |
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |