.NETGURU
Datagrid source= datarow array
Messages   Related Types
This message was discovered on microsoft.public.dotnet.general.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

rodchar (VIP)
Hey all,

I have an array of data rows that when I bind it to a datagrid it shows all
those extra rows in addition to my fields. How do I hide those fields?

I tried using the TableStyles property but seems like it's getting overridden.

Any ideas?

Thanks in advance,
rodchar
Reply to this message...
 
    
Cor Ligthert
Rodchar,

An array of datarows seems difficult to me to bind that to the columnstyles.

Normally is used the normal container for datarows "the datatable" with as
view the dataview which are make it so simple to select the proper columns
or rows.

I think you take the hard way, I am as well curious if somebody did that as
well.
It is such a nice build in feature ADONET.

Cor

> I have an array of data rows that when I bind it to a datagrid it shows
all
[Original message clipped]

Reply to this message...
 
    
rodchar (VIP)
What I'm using is the GetChildRows method which returns an array of datarows.
How do I get those rows into an empty table and then bind to my datagrid?

"Cor Ligthert" wrote:

[Original message clipped]

Reply to this message...
 
    
Cor Ligthert
Rodchar,

Just clone the original table and add the datarows to that by looping
through it, you can use for that the datarow.itemarray

I hope this gives an idea?

Cor

"rodchar" <Click here to reveal e-mail address>

> What I'm using is the GetChildRows method which returns an array of
datarows.
[Original message clipped]

Reply to this message...
 
    
rodchar (VIP)
Once I clone the table, how would I propagate the changes back into the
original dataset?

"Cor Ligthert" wrote:

[Original message clipped]

Reply to this message...
 
    
Cor Ligthert
Why do you than not use the relation to set the databinding of the datagrid?

Sample changed from an original program so watch typos
\\\
DataRelatieGF = New DataRelation _
("Gfunct", dsG.Tables("g").Columns("ng"), _
dsG.Tables("gf").Columns("ng"))
dsG.Relations.Add(DataRelatieGF)

dgGroepen.SetDataBinding(dsG, "g")
dgGroepFuncties.SetDataBinding(dsG, "g.gf")
///

Cor

Reply to this message...
 
    
rodchar (VIP)
ok, that worked. Now, how do I sync the datagrid with the drop down list?

"Cor Ligthert" wrote:

[Original message clipped]

Reply to this message...
 
    
Cor Ligthert
You nowhere told you where using a dropdownlist, do I understand that this
is a Webform application. However this confuses me, because in that do as
far as I know not exist tablestyles?

Cor

Reply to this message...
 
    
rodchar (VIP)
On a form, my dropdown list is bound to a column in my master table. The
datagrid is now, thanks to you, bound to the data relation name. However, I
don't know how to sync the datagrid to the drop down list selected value.

"Cor Ligthert" wrote:

[Original message clipped]

Reply to this message...
 
    
Cor Ligthert
Rodchar,

You are probable talking about a combobox (dropdown and dropdownlist are
controls from a webform).

Probably you can use binding the combobox text to the column in your
datasource table using something as

combobox.DataBindings.Add(New Binding("Text", dataset1.Tables(0),
"Mycolumname"))

(know that the combobox in my opinion acts sometimes strange with binding)

I hope this helps?

Cor

"rodchar" <Click here to reveal e-mail address> >

On a form, my dropdown list is bound to a column in my master table. The
> datagrid is now, thanks to you, bound to the data relation name. However,
I
[Original message clipped]

Reply to this message...
 
    
rodchar (VIP)
Thank you very much, that worked great!! You have been very helpful.
rodchar

"Cor Ligthert" wrote:

[Original message clipped]

Reply to this message...
 
 
System.Data.DataRelation




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification