Hi Shivendra,
Thank you for contacting Syncfusion support.
We have checked your requirement in our end. Unlike ASP DropDownList our EJ1 DropDownList is rendered based on jQuery from server-side wrappers. So this limits them from using both items and SQL dataSource simultaneously. But we can achieve your requirement in our controls by prepending the all item in the dataSource. You can do it either in server-side by directly adding the item to the SQL data or in the client side using the client-side event. Kindly refer to the following code.
<ej:DropDownList ID="ddlDept" runat="server" ClientSideOnBeforePopupShown="onshown" ClientSideOnDataBound="ondata">
</ej:DropDownList>
<script>
var count = 0;
function ondata() {
count = 0;
}
function onshown() {
if (this.model.dataSource != null && count == 0) {
this.model.dataSource.splice(0, 0, { ShipName: "All", OrderID: 0 });
var b = this.model.dataSource;
this.model.dataSource = null;
this.option("dataSource", b);
}
count++;
}
</script> |
Please let us know if you need any further assistance on this.
Regards,
Prince