If i will enter student roll no in text box,immediately i want to display the student details without using submit button.can anyone please tell me...
Regards,
Saritha
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Satyapriya NayakPosted Apr 23, 2013, 5:36 AM
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
namespace Textbox_gridview
{
public partial class _Default : System.Web.UI.Page
{
string strConnString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
string str;
SqlCommand com;
SqlDataAdapter sqlda;
DataSet ds;
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
bindgrid();
}
}
public void bindgrid()
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from employee";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "employee");
GridView1.DataMember = "employee";
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
protected void txt_empid_TextChanged(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strConnString);
con.Open();
str = "select * from employee where empid like '" + txt_empid.Text + "%'";
com = new SqlCommand(str, con);
sqlda = new SqlDataAdapter(com);
ds = new DataSet();
sqlda.Fill(ds, "employee");
GridView1.DataMember = "employee";
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
protected void Timer1_Tick(object sender, EventArgs e)
{
Label3.Text = DateTime.Now.ToString();
}
}
}
Sathish PabbathiPosted Apr 23, 2013, 3:12 AM
SarithaPosted Apr 23, 2013, 3:07 AM
Thanks for ur solution....
Sathish PabbathiPosted Apr 23, 2013, 2:30 AM
Sathish PabbathiPosted Apr 23, 2013, 2:03 AM
http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AutoComplete/AutoComplete.aspx
and to work with ajax in your aspx page addthe below tag in second or third line of your .aspx
source page
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>and also you have to add AjaxControlToolkit dll in your Solution Explorer References section
SarithaPosted Apr 23, 2013, 1:49 AM
Can u please provide me any javascript code for that...i don't have idea about ajax Autocomplete extender...
Sathish PabbathiPosted Apr 22, 2013, 8:56 AM
SarithaPosted Apr 22, 2013, 8:19 AM
SarithaPosted Apr 22, 2013, 7:55 AM
Sathish PabbathiPosted Apr 22, 2013, 7:48 AM
SarithaPosted Apr 22, 2013, 7:39 AM
Sathish PabbathiPosted Apr 22, 2013, 7:33 AM
SarithaPosted Apr 22, 2013, 7:25 AM
I tried it...but after entering roll no,if i will press enter then only it will display the student details...if u know..please provide me code...
Sathish PabbathiPosted Apr 22, 2013, 7:18 AM