i'm making a web app on asp.net and i need to call this method:
protected void fillList() {
string strSql;
dato = Convert.ToInt32(hiddenControl.Value);
SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["default"].ToString());
conn.Open();
strSql = "SELECT DISTINCT something FROM table WHERE data = " + dato;
SqlCommand camAND = new SqlCommand(strSql, conn);
System.Data.DataTable tablainc = new System.Data.DataTable();
camAND.CommandTimeout = 36000;
tablainc.Load(camAND.ExecuteReader());
foreach (DataRow dtr in tablainc.Rows)
{
list.Items.Add(dtrw[0].ToString());
}
}
That method is for insert items on listbox , i need do that when the javascript event OnBlur happens, this is my JS function:
function frmt_Date() {
var text = document.getElementById("txperiodo").value;
var newText = text.replace("/", "");
document.getElementById("hiddenControl").value = newText;
var periodo = parseInt(newText);
document.getElementById("hiddenControl").value = periodo;
How can i call my method in Ajax? this is my html input:
<input runat="server" id="txperiodo" class="cc1" type="text" placeholder="AAAA/MM" maxlength="7" onblur="frmt_Date()"/>
Thank you and please tell me if im wrong.