Hi,
Here I have created sample.Please check if your selectbox is undefined of null while passing to addOption Method.
HTML
<div>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
fillstates();
});
function addOption(selectbox, text, value) {
var optn = document.createElement("OPTION");
text = text.replace(/&/g, '&');
value = value.replace(/&/g, '&');
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
function fillstates() {
var stateArray = document.getElementById('<%=hdnSateNames.ClientID %>').value.split("#");
for (var count = 0; count <= stateArray.length - 1; count++) {
var state = stateArray[count];
var stateCode = (state.split(";")[0]);
var StateName = (state.split(";")[1]);
addOption(document.getElementById('<%=BMO_ddlMortgagorState.ClientID%>'), StateName, stateCode);
}
}
</script>
<asp:HiddenField ID="hdnSateNames" Value="01;Maharashtra#02;Goa" runat="server" />
<asp:DropDownList ID="BMO_ddlMortgagorState" runat="server">
</asp:DropDownList>
</div>
Screenshot