-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: dataGridView begginer problem
PostPosted: Tue Nov 09, 2010 2:28 pm 
Regular
Regular

Joined: Fri Feb 09, 2007 3:47 pm
Posts: 56
Hi,

Since I'm new to NHibernate I have some problems with putting achieved data into datagridview.
Basicly here is what I do:

bindingSource.DataSource = provider.GetBookById(1);
dataGridView1.DataSource = bindingSource;
and thats my simple database structure:
http://img338.imageshack.us/img338/115/db1t.jpg

Data I get from method GetBookById(1) is in form
int
string
string
publisher

In datagridview all of my columns are shown properly but Publisher which shows DataTransfer.Publisher.
I just have no clue how to extract PublisherName from Publisher Object in Datagridview.

Any sugestions are welcome :)
Thanks in advance!


Top
 Profile  
 
 Post subject: Re: dataGridView begginer problem
PostPosted: Wed Dec 01, 2010 4:33 pm 
Newbie

Joined: Wed Dec 01, 2010 4:15 pm
Posts: 3
If you just need the publisher name in a single column, then try overriding the ToString method in the DataTransfer.Publisher class. Something like this:

Code:
public class Publisher
{
  ...
  public string PublisherName { get; set; }
  ...
  public override string ToString()
  {
    return PublisherName;
  }
  ...
}


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.