1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Get form control by field id

Get form control by field id

5 posts, 0 answered
  1. Salma
    Salma avatar
    3 posts
    Registered:
    23 May 2011
    20 Nov 2011
    Link to this post
    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 ??
  2. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    22 Nov 2011
    Link to this post
    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
  3. Saad
    Saad avatar
    98 posts
    Registered:
    10 Oct 2008
    26 Nov 2011
    Link to this post
    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?
  4. Saad
    Saad avatar
    98 posts
    Registered:
    10 Oct 2008
    27 Nov 2011
    Link to this post
    Anyone?
  5. Victor Velev
    Victor Velev avatar
    1345 posts
    Registered:
    06 Jul 2015
    29 Nov 2011
    Link to this post
    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
5 posts, 0 answered