Knowledge Base
 
 
Knowledge Base Forum
Testimonials
It’s really refreshing to use. Looking at codegen products that are way overkill and generate source code that’s not maintainable - your product rocks.


I have demoed several other products also, and none came close to yours. The simplicity, ease of use and user friendliness were impeccable.
William Joshua
Madison County Schools


Thanks to smartDBforms.NET I am able to save lots of time and make even better websites. I am looking forward to use this tool to help me build websites based on databases.
Anton Beerens
www.blauwwit81.nl


We are really impressed with smartDBforms.NET and there is nothing else on the market as good.
Andy Jones
Make I.T. Simple
www.makeitsimple.info
Search knowledge base:

HOWTO: Change the display text for the foreign key values
Monday, 09 April 2007
When a database field being edited is a foreign key field then all the rows from the parent table are displayed. The article explains how to customize the display text for the FK values.

SUMMARY

When a database field being edited is a foreign key field then all the rows from the parent table are displayed. The user chooses one of the parent rows and its value is saved as a value for the field being edited. By default the parent table rows are represented by the value of the first text column in the parent table. The article explains how to customize the display text for the FK values.

MORE INFORMATION

Lets consider a simple example. The Products database table has a column CategoryID, which is a foreign key to the CategoryID column of the Categories database table. Categories table has the following columns: CategoryID, CategoryName, Description, Picture .In the default case the user interface will display a list of the CategoryName values for the rows in the Categoies table.

To change the display text for the values you should specify a RowCaption Expression for the Categories table. The expression can contain column names from the columns of the FK parent table. In our case this will be the columns of the Categories table. An appropriate expression is "CategoryName+'( '+Description +' )'". The syntax of the expression is described here - MSDN - DataColumn.Expression Property.

There are two places where you can specify the RowCaption Expression. Either in a Global ASP.NET resource or in the database table's extended properties.

Global ASP.NET resource

Open the .resx file which is specified in the smartDBforms.NET/resourceClassKey attribute in Web.config. Enter a new value. The name of the value should be like <TableName>.RowCaptionExpression. In our case this will be "Categories.RowCaptionExpression" . The value will be "CategoryName+'( '+Description +' )'".

Database extended property

Open MS SQL Management Studio, find the table and right-click on it. Select the Properties menu item. In the Table Properties dialog select the Extended Properties page. Enter a new value. The name of the value should be SDBF_RowCaptionExpression.

CONCLUSION

After the change is applied the user interface for the CategoryID field will look like this:

You can find more information about smartDBforms.NET Caption and Description configuration in the online documentation.


Page Options: format for printing  Format for Printer

Copyright 2006-2011 Adillis Terms Of Use Feedback Contact Us