November Happy Hour will be moved to Thursday December 5th.

How to save required form elements data in database(i.e:-tblBigtable)???

Vote:
 

Hi Guys,

   I created one registration form with four textbox elements(i.e:username,surname,mailid and contact number),but i want to save only three elements data(i.e:username,surname,mailid) in tblBigtable and save the contact number in another table.If any one know about this help me out of this.

Thanks,

Ramkee.G

#188750
Mar 02, 2018 7:55
Vote:
 

You can create your own DataSubmissionService then override the method GetSubmissionData where you can call the base then remove the contact number field before return submission data (and also save number to your table). Is that solving your problem?

#188753
Mar 02, 2018 8:53
Vote:
 

Hi Dac Thach Nguyen,thanks for your reply.can you explain abit about it or provide some referance code 

Thanks,

Ramkee.G

#188754
Edited, Mar 02, 2018 9:23
Vote:
 
<p>Create your service</p> <pre class="brush:csharp;auto-links:false;toolbar:false" contenteditable="false">[ServiceConfiguration(typeof(DataSubmissionService), Lifecycle = ServiceInstanceScope.Singleton)] public class CustomDataSubmissionService : DataSubmissionService { protected override Submission GetSubmissionData(NameValueCollection rawSubmittedData, FormContainerBlock formContainer, HttpContextBase httpContext, bool isFinalized) { var data = base.GetSubmissionData(rawSubmittedData, formContainer, httpContext, isFinalized); // Save your phone number from posted data var phone = data.Data["_field_123"]; // remove your phone number field data.Data.Remove("_field_123"); return data; } }</pre> <p>Register your service in initialize module to make form use your service instead of default one:</p> <pre class="brush:csharp;auto-links:false;toolbar:false" contenteditable="false">public void ConfigureContainer(ServiceConfigurationContext serviceConfigurationContext) { serviceConfigurationContext.Services.AddSingleton&lt;DataSubmissionService, CustomDataSubmissionService&gt;(); }</pre> <p></p>
#188755
Mar 02, 2018 9:39
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.