Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Binding Data to Forms


Message #1 by "Hugh McLaughlin" <hugh@k...> on Sun, 2 Dec 2001 22:47:44
Hello Everyone and thanks for your help in advance.  I am developing an 

application that uses a form to input information about a person, for 

instance name, address, etc.  The application will allow new records to be 

added as well as editing and deleting.  I want to utilize the same form 

for all three functions, determining the action by the value of the input 

field.  My dilemna is populating the form from the database.  If I use the 

syntax:



<asp:textbox id="FullName"  Value="<%# Container.DataItem("FullName") %

>"runat="server" />



That will work fine if the action to be performed is upadte or delete and 

a record exists.  But if the function is Add and the form is loaded, there 

is no record to populate this field and I think it will give me an error.  

How do I go about conditionally setting the value attribute of this field 

i.e. NULL if the action is add and the database value if the action is 

upadte or delete.  



Any help on this will be greatly appreciated.  Thanks.

  Return to Index