Bind datasource to FormDropDownList
Hi,
I am using sitefinity 4.4.
I need to bind datatable to formdropdownlist control.
where should i write code for that?
What i have done is , i have inherited FormsControl and trying to override its events. but i am bot able to get the event wherein i can bind table to formdropdownlist control.
Please help.. its urgent.
Thanks & Regards,
Shalaka.
Hello,
I have attached a custom form control that have form dropdown with custom data source. I suppose this might be of help to you.
All the best,Hi,
Sorry. but i have not understood that how can i use this code which is provided by you....
this code does not contain any dropdown list control.....
Please reply.
Is there any other alternative?
Hello,
Excuse me I have attached the wrong control, here is the updated control with dropdown list prepopulated with custom data source.
Greetings,Hi,
Sorry. but whatever u have given is not as per my requirement.
I need to bind dropdown which is on my formcontrol - which is sitefinity form control.
i have attaching my cs file
i have designed the form using sitefinity admin - content - form module.
and i am overriding the submit button event.
The form contain one dropdown control. and i need to bind that control.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Text;
using System.Text.RegularExpressions;
using Telerik.Microsoft.Practices.EnterpriseLibrary.Logging;
using Telerik.Sitefinity.Configuration;
using Telerik.Sitefinity.Forms.Model;
using Telerik.Sitefinity.Modules.Forms;
using Telerik.Sitefinity.Modules.Forms.Web.UI;
using Telerik.Sitefinity.Modules.Forms.Web.UI.Fields;
using Telerik.Sitefinity.Services;
using Telerik.Sitefinity.Web.UI.Fields;
using Telerik.Sitefinity.Web.UI;
using System.Data;
namespace CustomFormControlTest
public class FormControlCustom: FormsControl
DataSet ds = new DataSet();
#region Members
/// <summary>
/// This is the embedded control template for the FormControls.
/// </summary>
private const string layoutTemplateName = "CustomFormControlTest.Resources.FormsControl.ascx";
#endregion
#region Properties
/// <summary>
/// Gets or Sets the layout template name for the control.
/// </summary>
protected override string LayoutTemplateName
get
return FormControlCustom.layoutTemplateName;
#endregion
protected override void ConfigureSubmitButton(System.Web.UI.Control control, string validationGroup)
var submit = control as FormSubmitButton;
submit.Click += new EventHandler(submit_Click);
base.ConfigureSubmitButton(control, validationGroup);
protected override void OnFieldValidation(FormFieldValidationEventArgs args)
var dat = Pagecaptua;
if (dat.IsValid == false)
args.Cancel = true;
protected override void OnBeforeFormSave(CancelEventArgs args)
var dat = Pagecaptua;
if (dat.IsValid == true)
args.Cancel = false;
else
args.Cancel = true;
void submit_Click(object sender, EventArgs e)
//code for validating fields --
foreach (var fieldControl in this.FieldControls)
// ((FormTextBox)fieldControl).FieldName=""
if (fieldControl is FormTextBox)
var data = ((FormTextBox)fieldControl).Value;
var date = fieldControl.MetaField.FieldName;
public static Telerik.Web.UI.RadCaptcha Pagecaptua get; set;