Thursday, July 16, 2009

Tip: How to hide datagrid column in Windows Mobile 6.1

I have a datagrid that contains 3 columns; Product Code, Product Package, and Quantity. However, the datasource of the datagrid is a datatable with the name "ProductList" that contains Product Id, Product Code, Product Description, Package, and Qty. When the datatable is binded to the datagrid, all the fields in the datatable are shwon in the datagrid. So how do we hide those unwanted fields from showing in the front end?

1. Create a DataGridTableStyle for the DataGrid and add in the styles for column: Product Code, Product Package, and Quantity.
2. In the DataGridTableStyle "MappingName" property, makes sure you put in "ProductList" as the value. This value tells the DataGrid to map the fields to the "ProductList" table and to hide those fields that are not stated in the GridColumnStyles collection.

Monday, July 13, 2009

Tip: Microsoft Service Factory Host Model Insight - The needs to include the "Service Implementation" layer.

Whether you are developing a WCF or ASMX service, the Microsoft Service Factory Host Model allows user to add in ".svc" or ".asmx" files that can be accessed from within a "Website" project that you will host using IIS. However, the problem is we cannot use the standard ASP.NET Application project to fit into the host model designer. The designer only recognize "Website" project and hence you wont be able to update the web.config or even add in the ".svc" file into the project using the designer. Even worst is, the "Website" project does not generate the necessary "Website.dll" file when you compile the project. This prevents you from generating the necessary proxy for your service when you execute "Add Service" function.

If you observed the example that comes with the Service Software Factory, you will notice that it contains another layer called the "Service Implementation". This separate dll in the solution represents a dll that you can include into the "Website" project that acts as a host for the service(s) that you are going to expose. By including the dll in the "Website" project, you will not have problem accessing the service(s) in the Host Model designer.