hi,
I want javascript for submit form without using submit button when enter value in textbox automatically without pressing any submit button and any enter key i want to get output.
Loading
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.
Vishal GilbilePosted Apr 23, 2013, 5:27 AM
Kindly check the following code snippet
Markup file
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
Code Behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class Default3 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
lblData.Text = "Hello World";
}
}
I'm also providing an original copy of the same with this reply
SarithaPosted Apr 23, 2013, 6:52 AM
I don't want to refresh complete page...what can i do?
SarithaPosted Apr 23, 2013, 6:36 AM
SarithaPosted Apr 23, 2013, 6:34 AM
SarithaPosted Apr 23, 2013, 6:21 AM
Hi,
This is not my requirement...if u understand my requirement go to this site http://schools9.com/apinter1g.htm and enter hall ticket number 1322122819,then immediately it will display the details without clicking on any button..
Satyapriya NayakPosted Apr 23, 2013, 6:06 AM
'Timer1' requires a ScriptManager on the page.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Textbox_gridview.WebForm1" %>
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 WebForm1 : 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();
}
}
}
SarithaPosted Apr 23, 2013, 5:58 AM
Vishal GilbilePosted Apr 23, 2013, 5:50 AM
SarithaPosted Apr 23, 2013, 5:45 AM
Satyapriya NayakPosted Apr 23, 2013, 5:35 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();
}
}
}
SarithaPosted Apr 23, 2013, 4:58 AM
SarithaPosted Apr 23, 2013, 4:52 AM
Vishal GilbilePosted Apr 23, 2013, 4:49 AM
1. you are providing a dropdownlist to the user and allowing him to select the hall ticket or
But if the hall ticket is a security issue then the following would be the better approach
2. providing him with a textbox and one submit button on whose click you will hit the DB and fetch the respective records.
Hope it helps you.
SarithaPosted Apr 23, 2013, 4:40 AM
Vishal GilbilePosted Apr 23, 2013, 4:35 AM
SarithaPosted Apr 23, 2013, 4:07 AM
Vishal GilbilePosted Apr 23, 2013, 4:03 AM
SarithaPosted Apr 23, 2013, 3:54 AM
u understand my question now...
SarithaPosted Apr 23, 2013, 3:40 AM
Here is my question...
Suppose,if i will enter 10 digit hall ticket number in text box,after entering hall ticket number i will get complete details of student without pressing submit button or any other keys..
Vishal GilbilePosted Apr 23, 2013, 3:35 AM
If your are using ScriptManager on your page the way of calling would be like the following.
ScriptManager.RegisterStartupScript(this,this.GetType(),"insert","Submit()",true);
else if there is no script Manager present on the page then you can call like the following
ClientScript.RegisterStartupScript(this.GetType(),"insert","Submit()",true);
Hope it solves your proble,.
SarithaPosted Apr 23, 2013, 3:30 AM
Where i want to write code in cs file.
Jaffreena MichaelthomasPosted Apr 23, 2013, 3:25 AM