Use contents of one field as caption for another field

Tips submitted by ASP.NET Maker users

Use contents of one field as caption for another field

Postby pel » Wed Mar 10, 2010 5:54 am

You can use the contents of one field in your table (such as a product name) as the caption for another field in the table; just enter your code (using vb.net in this example) as the caption of the second field:

<% Response.Write(ew_ExecuteScalar("SELECT Product101_Desc FROM Products") ) %>

You can also add additional text to the caption:

<% Response.Write(ew_ExecuteScalar("SELECT Product101_Desc FROM Products") & " YTD") %>
pel
 

Re: Use contents of one field as caption for another field

Postby pel » Mon Mar 29, 2010 12:44 am

This tip for creating field captions can cause a problem if you're doing client side validation for the field (due to the way the javascript is constructed). If you use this method of building field captions and want to validate entries you need to do server-side validation.
pel
 

Re: Use contents of one field as caption for another field

Postby Frank » Wed Apr 14, 2010 9:33 pm

That's a very helpful tip. Thank you for posting it.
Frank
 


Return to User Submited Tips (ASP.NET Maker)