Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> TableStyle
 

Pages: 1
LLBLGen Pro Runtime Framework
TableStyle
Page:1/1 

  Print all messages in this thread  
Poster Message
Rhywun
User



Location:
NYC
Joined on:
05-Jan-2005 02:17:57
Posted:
44 posts
# Posted on: 24-Jan-2005 03:52:16.  
I'm trying to create a custom TableStyle for my Windows Forms DataGrid. I created a new TableStyle, used "" for the MappingName like it says in another thread, and added just one column to the TableStyle. But when I run the program I get all the fields from the collection instead of my custom TableStyle. I tried various approaches including setting the DataSource at design time and setting it in code, with the same results. So how exactly do I bind the collection to a DataGrid and show custom columns?
Self-Servicing, LLBLGenPro v. 2.5.0.0
ORMSupportClasses.NET20.dll v. 2.5.0.0
.NET v. 2.0.50727, VS v. 8.0.50727.51
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37546 posts
# Posted on: 24-Jan-2005 10:26:25.  
Do you use adapter or selfservicing? Could you paste some code please, which you've tried and which failed so I can try to reproduce it here?

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Rhywun
User



Location:
NYC
Joined on:
05-Jan-2005 02:17:57
Posted:
44 posts
# Posted on: 24-Jan-2005 14:37:43.  
Otis wrote:
Do you use adapter or selfservicing?


Self-servicing:

Code:
private void searchButton_Click(object sender, EventArgs e)
{
    // First DataGrid, no table style, DataSource = collection that I dragged in
    // from the designer
    IPredicateExpression selectFilter = new PredicateExpression();
    string searchValue = this.searchValueTextBox.Text;
    selectFilter.Add(PredicateFactory.Like(HeadwordFieldIndex.TonelessRoman, searchValue));
    this.phrasesHeadwordCollection.GetMulti(selectFilter);

    // Second DataGrid, I created the collection in code
    // and I created a table style in designer
    // with one text box column bound to the first field in the collection
    HeadwordCollection charactersHeadwordCollection = new HeadwordCollection();
    this.charactersDataGrid.DataSource = charactersHeadwordCollection;
    this.charactersHeadwordCollection.GetMulti(selectFilter);
}


Here is the code for the table style:

Code:
//
// dataGridTableStyle2
//
this.dataGridTableStyle2.DataGrid = this.charactersDataGrid;
this.dataGridTableStyle2.GridColumnStyles.AddRange(new System.Windows.Forms.DataGridColumnStyle[] {
    this.dataGridTextBoxColumn2});
this.dataGridTableStyle2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGridTableStyle2.MappingName = "";
//
// dataGridTextBoxColumn2
//
this.dataGridTextBoxColumn2.Format = "";
this.dataGridTextBoxColumn2.FormatInfo = null;
this.dataGridTextBoxColumn2.HeaderText = "Pinyin";
this.dataGridTextBoxColumn2.MappingName = "Pinyin";
this.dataGridTextBoxColumn2.Width = 75;


At runtime, both data grids show all the columns in the collection. The first grid shows all the columns when the form opens, and the second grid shows all the columns after the searchButton_Click method runs.
Self-Servicing, LLBLGenPro v. 2.5.0.0
ORMSupportClasses.NET20.dll v. 2.5.0.0
.NET v. 2.0.50727, VS v. 8.0.50727.51
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37546 posts
# Posted on: 24-Jan-2005 16:28:27.  
Ok, I'll check it out.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Otis
LLBLGen Pro Team



Location:
The Hague, The Netherlands
Joined on:
17-Aug-2003 18:00:36
Posted:
37546 posts
# Posted on: 24-Jan-2005 18:29:41.  
Set the table mapping style's MappingName to "HeadwordCollection".

Selfservicing works differently in this than adapter. In adapter I made the mistake of not returning the listname in ITypedList.GetListName(), as it should be returned by generated code, but this was omitted. The result was that mentioning a name for MappingName would not work, so a "" had to be mentioned. Fixing this was not possible as that would break all adapter binding code already implemented by customers.

Frans Bouma
LLBLGen Pro / ORM Profiler Lead Developer | Blog | Twitter
 
Top
Rhywun
User



Location:
NYC
Joined on:
05-Jan-2005 02:17:57
Posted:
44 posts
# Posted on: 25-Jan-2005 02:40:58.  
Otis wrote:
Set the table mapping style's MappingName to "HeadwordCollection".


Works great - especially with the drag-n-drop collection. Thanks!


Self-Servicing, LLBLGenPro v. 2.5.0.0
ORMSupportClasses.NET20.dll v. 2.5.0.0
.NET v. 2.0.50727, VS v. 8.0.50727.51
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.