Hi Bobby,
First of all great piece of work.
I think stumbled across a bug in the EntityDataSource.When the method GetEntityList is called and _entityList != null than the arguments.TotalRowCount is not properly set. This may cause a problem when using controls who need this RowCount like the Telerik Grid Control.
To solve this problem I defined a private field _entityCount and used this to remember the rowcount for me. In GetEntityList arguments.TotalRowCount will be set to _entityCount when the entitylist exists.
Kind Regards,
Niels Schneider
Hey velum.
I'm also reasonable new to NetTiers so I was pondering something similar.
For your example, you would set up a foreign key on ContactID obviously.Then NetTiers would pick up that key and allow you to do the following:
Customers MyCustomer = DataRepository.CustomersProvider.GetByID(1);//Populate the ContactIDSource MyCustomer.ContactIDSource = DataRepository.ContactsProvider.GetByID(MyCustomer.ContactID);//Use the ContactIDSourceMessageBox.Show(MyCustomer.ContactIDSource.ContactName);//Edit the ContactIDSourceMyCustomer.ContactIDSource.ContactName = "John Doh";//Save the changesDataRepository.ContactsProvider.Save(MyCustomer.ContactIDSource);
What I don't know how to do, is to display the Contact Name in a datagrid next to the company name. I tried setting a Bound Column to be "ContactIDSource.ContactName". That didn't work.
Well...
Hope this helps...
and it would be great if someone could tell me how to display the CompanyName 'joined' to the ContactName in a DataGrid.
ThanksDaryl
bdiaz wrote:Michael (mike123) gave a great tip over in the General Support forum and I wanted to include it as part of the documentation. The following code snippet shows how you can set the value of a CustomParameter object at runtime:using Northwind.Web.Data;...CustomParameter p = CustomersDataSource.Parameters["WhereClause"] as CustomParameter;p.Value = "Country = 'USA'";
I am currently attempting to write a filter form above my gridview control. I have a DropDownList for field name and a DropDownList for asc/desc.I am looking to pass these values into my ClientsDataSourceObject via a button onClick event.I tried to use the above code but with no luck, can someone please post a working example of the above code in action as this simple problem has given me a headache all weekend.
Yours
David Lawton
bdiaz wrote:David,Can you post some sample code for your GridView and data source control so that I can give you a meaningful example?Thanks.
Will do, codes at home and i am at work right now. will post tonight or tomorrow morning.
Thanks
I've just been playing with this and it seems to me that the 'OrderByClause' should actually be 'OrderBy'; i.e.
<data:CustomParameter Name="OrderBy" Value="CompanyName ASC" ConvertEmptyStringToNull="false" />
I can't get the sort to work without this amendment.
More work on sorting seems to indicate that I need to change this:
<data:CustomParameter Name="OrderByClause" Value="CompanyName ASC" ConvertEmptyStringToNull="false" />
To this:
<
But this doesn't allow control of the sort direction.
These changes give me a sortable GridView but I feel I might be missing something here... ?
I’m trying to get a GridView to sort on a foreign key column using NetTiers. This is not supported on the EntityGridView on HyperLinkField Columns as well. To explain a bit further on what I’m trying to achieve I’ll take the above listed example.
[Customers] CustomerID CompanyName ContactID Address City Region PostalCode Country Phone Fax[Contacts] ContactID ContactName ContactTitle
Jayawewa,
Try this (not an elegant solution though ...)
<data:HyperLinkField HeaderText="Contact" DataContainer="ContactIDSource" DataTextField="ContactName" SortExpression="(SELECT c.ContactName FROM Contacts c WHERE Customers.ContactID = c.ContactID)" />
or this way:
<asp:TemplateField HeaderText="Contact" SortExpression="(SELECT c.ContactName FROM Contacts c WHERE Customers.ContactID = c.ContactID)"> <ItemTemplate> <%# Eval("ContactIDSource.ContactName")%> </ItemTemplate> </asp:TemplateField>
Mike Shatny--------------------------------------------------------------Member of the .netTiers team http://www.nettiers.com--------------------------------------------------------------