Click here to Skip to main content
15,887,381 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
XML
Dear All,
This Md Syedur Rahman. I am trying implement autocomplete without using ajax in Asp.Net. Given code below:

frmCrmOffer.aspx file:
<head>
<script type="text/javascript">
$(document).ready(function () {

var item = '<%=this.data%>';
var lists = new Array();
lists = item.split(',');
$("#txtauto").autocomplete({
source:lists
});
});
</script>
</head>

.cs file

protected void Page_Load(object sender, EventArgs e)
{


FillData();
}


public void FillData()
{
DataTable dt = new DataTable();
SqlCon = db.GetDBConn();
MySqlCommand sqlcmd = new MySqlCommand();
SqlCon.Open();
MySqlDataAdapter da = new MySqlDataAdapter("select name from mbi_customers where type='Dealer' and status=1 order by name", SqlCon);
da.Fill(dt);
SqlCon.Close();

if (dt.Rows.Count > 0)
{
for (int i = 0; i < dt.Rows.Count; i++)
{
data += (Convert.ToString(dt.Rows[i]["Name"])) + ",";
}
}
}



when I run application generate this Error
The Controls collection cannot be modified because the control contains code blocks (i.e. <% ... %>).

How can Solved this Problem.


Md Syedur Rahman
syed.syed04@gmail.com
Posted
Comments
Kornfeld Eliyahu Peter 2-Sep-14 3:37am    
I think you should show us more of your ASPX page...
Member 9245259 2-Sep-14 4:54am    
yes

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900