Get form control by field id

Posted by Community Admin on 04-Aug-2018 13:47

Get form control by field id

All Replies

Posted by Community Admin on 20-Nov-2011 00:00

I am trying to read the values stored in a dropdown list form control. i am using the following code 

var sfform = FormsManager.GetManager().GetFormByName("sf_feedback");
var control = sfform.Controls;

but i am having a problem getting the control from the form by it's field name

any help ??

Posted by Community Admin on 22-Nov-2011 00:00

Hi Salma,

Please refer to the following code - what it does is to retrieve the values in sf_test form for the submitted dropdownlist control, called formdropdownlist1:

FormsManager formsManager = FormsManager.GetManager();
          var forms = formsManager.GetForms().Where(f => f.Name == "sf_test");
          foreach (var form in forms)
          
              var records = formsManager.GetFormEntries(form);
              foreach (var record in records)
              
                  FormEntry fe = (FormEntry)record;
                  var Value1 = fe.GetValue("formdropdownlist1");
              
          


Greetings,
Victor Velev
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 26-Nov-2011 00:00

Hello Victor,
How can I get only fields that shows up in the form, that is how can I just pick up the values of the fields excluding IP, DateSubmitted, ID etc?

Posted by Community Admin on 27-Nov-2011 00:00

Anyone?

Posted by Community Admin on 29-Nov-2011 00:00

Hello Saad,

I could not really understand your request. Can you be more specific in describing the user - case scenario you want to achieve?

Best wishes,
Victor Velev
the Telerik team

Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed