ASPX templates
Version 5.x > ASPX templates > Retrieving data from specialized CMSControls View modes: 
User avatar
Member
Member
jgriffith-nfusion - 12/5/2011 10:48:07 AM
   
Retrieving data from specialized CMSControls
Hi,

How do I access data after Bizform submit from the country and state control, the international phone control, and email control?

My code for normal input fields looks like this:

Control first_name = this.frmContactRegInput.BasicForm.FindControl("First_Name");
((TextBox)first_name).Text

I am thinking I need the exact casting for this to work with these specific Kentico controls.

Thanks!


User avatar
Member
Member
kentico_michal - 12/6/2011 1:45:17 AM
   
RE:Retrieving data from specialized CMSControls
Hello,

The BizForm control is based on the BasicForm control that provides a property called FieldControls. It is a standard HashTable that contains all controls as FormEngineUserControl.

However, if you need only the entered data, it should be possible to use the BasiForm.DataRow property instead, for example:

DataRow row = BizFormControl.BasicForm.DataRow;
string email = ValidationHelper.GetString( row["EmailField"], String.Empty );


Moreover, the BizForm control provides a few handlers you can use to access the entered data, such as OnAfterSave, OnBeforeValidate, OnUploadFile, etc.

I would like to point you to the following knowledge base article that demonstrates how you can use the OnUploadFile handler to validate the size of uploaded file: How to validate the size of uploaded file in BizForm

FYI: BasicForm.DataRow has been replaced with BasicForm.Data in Kentico CMS 6.0

Best regards,
Michal Legen