Home
Help
Register
Log in

Search

 
   Active Threads  

You are here: Home > LLBLGen Pro > LLBLGen Pro Runtime Framework> LLBLGenProDataSource2 not updating w/ empty text box
 

Pages: 1
LLBLGen Pro Runtime Framework
LLBLGenProDataSource2 not updating w/ empty text box
Page:1/1 

  Print all messages in this thread  
Poster Message
tprohas
User



Location:
Tucson, AZ
Joined on:
23-Mar-2004 00:00:43
Posted:
257 posts
# Posted on: 20-May-2008 00:25:55.  
LLBLGen 2.5
Runtime: v2.0.50727
ASP.NET 2.0

Hello all,

I have a LLBLGenProDataSource2 control wired up to a DetailsView for editing. The details view pulls up the data and I now want to delete the data from the text box which it's displayed in. The problem is that deleting the text and saving does not change anything. It acts like the empty text box isn't changed so the entity isn't changed or updated when saving.

Can anyone tell me why this is happening? Shouldn't a field which has data deleted from it save as en empty string?
Aaron Prohaska
http://www.verdesoft.com/
 
Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8060 posts
# Posted on: 20-May-2008 04:45:35.  
Hi Aaron, I guess the field isn't nullable and the DetailsView or/and LLBLGenProDataSource2 is sending the value as NULL which isn't a valid value.

Quote:
Shouldn't a field which has data deleted from it save as en empty string?

Yes if you want. For that you should:

1. Tell LLBLGenProDataSource2 that "empty strings" should be treated as "empty strings", not NULL values (Ref: LLBLGenPro Help -> Using the generated code -> Adapter -> Databinding at designtime and runtime -> Databinding with APS.NET 2.0 -> Converting empty string values ("") to NULL values for inserts/updates):
Code:

yourLLBLGenProDataSource.AllFieldsKeepEmptyStringAsValue = true;


or per field basis:
Code:
// in your Page Load handler routine
if( !Page.IsPostBack )
{
    List<string> fieldsWhichShouldKeepEmptyString = new List<string>();
    fieldsWhichShouldKeepEmptyString.Add( "ShipAddress" );
    _ordersDS.FieldNamesKeepEmptyStringAsValue = fieldsWhichShouldKeepEmptyString;
}


2. The grid/detailsView has for every field a property (click on 'Edit fields' in the smarttag of the grid): ConvertEmptyStringToNull. THis is by default set to true. This means that an empty value is send to the datasourcecontrol as null, not as empty string. So the datasourcecontrol receives a null, which means it can't accept it as the field isn't nullable. If you set the property ConvertEmptyStringToNull to false for a textfield which should accept "", an empty textbox will send a "" to the datasourcecontrol, which is then accepted as a value (Ref...).


David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
tprohas
User



Location:
Tucson, AZ
Joined on:
23-Mar-2004 00:00:43
Posted:
257 posts
# Posted on: 20-May-2008 18:59:36.  
So when saving a entity and the entity's field is changed but does not have a value why is the default value used null and not the entity's default field value. Seems like it would be better to have an entity save a field value as that fields default value. In this case the default value for the field being a string.
Aaron Prohaska
http://www.verdesoft.com/
 
Top
tprohas
User



Location:
Tucson, AZ
Joined on:
23-Mar-2004 00:00:43
Posted:
257 posts
# Posted on: 20-May-2008 23:26:44.  
Hello daelmo,

I've now tried all three of these methods and I still cannot save an empty text box. Is there anything else I can try?


Aaron Prohaska
http://www.verdesoft.com/
 
Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8060 posts
# Posted on: 21-May-2008 05:00:23.  
You have to do the two steps (1 and 2) I posted.
Anyway, pleas post your actual code: relevant declarative aspx of the DetailsView and LLBLGenProDataSource and any relevant codebehind code.
David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
daelmo
Support Team



Location:
Guatemala City
Joined on:
28-Nov-2005 23:35:24
Posted:
8060 posts
# Posted on: 21-May-2008 05:02:00.  
tprohas wrote:
So when saving a entity and the entity's field is changed but does not have a value why is the default value used null and not the entity's default field value. Seems like it would be better to have an entity save a field value as that fields default value. In this case the default value for the field being a string.

It's a matter of the GUI controls, not exactly LLBLGen framework.


David Elizondo
LLBLGen'ing (articles and code snippets) | linkedin | twitter
 
Top
Pages: 1  


Powered by HnD ©2002-2007 Solutions Design
HnD uses LLBLGen Pro

Version: 2.1.12172008 Final.