Hi Egi,
Thanks for contacting Syncfusion Support.
Query 1: i want to show a drop down list with companies and wattermark text ("empty" default value as "--- Select Company ---"). When user clicks on a save button client validation must occur if user did not select any company.
We have prepared the sample based on your requirement and please refer to the following sample:
Sample: Sample
In this sample, we have passed DB data to the Datasource property of dropdownlist and set the dropdownlist properties in the server side as shown below code:
<code>
public ActionResult Index()
{
DropDownListProperties ddp = new DropDownListProperties();
ddp.DataSource = getMakes();
ddp.EnableFilterSearch = true;
ddp.WatermarkText = "--- Select Company ---";
ddp.Width = "100%";
DropDownListFields df = new DropDownListFields();
df.Text = "LastName";
df.Id = "EmployeeID";
df.Value = "LastName";
ddp.DropDownListFields = df;
ViewData["userCompany"] = ddp;
return View();
}
public List<Make> getMakes()
{
var ds = new DataClasses1DataContext();
List<Make> data = new List<Make>();
data = (from ord in ds.Employees
select new Make
{
EmployeeID = ord.EmployeeID,
LastName = ord.LastName
}).ToList();
return data;
}
</code>
Could you please check with the above sample? If still see the same issue, please modifying the sample based on your application along with replication procedure and send it back to us.
Query 2: page reloads with filled form fields except EJ().DropDownListFor - it shows no data and also it looses it's styling and look like old-school html input field.
To render the controls kept inside partial view, we need to refer script manager in the partial view in which the controls are present. Then the control will be rendered properly. Please refer to the below code:
<code>
@(Html.EJ().ScriptManager())
</code>
Please let us know if you need any further assistance.
Regards,
Kasithangam.