TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
maliya rama
NA
8
22.3k
TAB key in the keyboard to go one field to another
Mar 4 2013 4:47 AM
In this code... when i run this page i want to use TAB key in the keyboard to go one field to another but work does not proper help me
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
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;
public partial class Registration : System.Web.UI.Page
{
SqlConnection cnn1 = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=E:\CMSWEB\App_Data\EMS.mdf;Integrated Security=True;User Instance=True");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
FillCountry();
FillState();
FillCity();
}
}
protected void FillCountry()
{
string strCmd="";
strCmd = "Select * from tblCountry";
SqlDataAdapter adpt1 = new SqlDataAdapter(strCmd, cnn1);
DataSet ds1 = new DataSet();
adpt1.Fill(ds1);
ddlCountry.Items.Clear();
if (ds1.Tables[0].Rows.Count > 0)
{
ddlCountry.DataSource = ds1;
ddlCountry.DataTextField = "Name";
ddlCountry.DataValueField = "Id";
ddlCountry.DataBind();
}
ddlCountry.Items.Insert(0, new ListItem("Select", "-1"));
}
protected void FillState()
{
string strCmd;
strCmd = "Select * from tblState where CountryId=" + ddlCountry.SelectedValue +" order by Name";
SqlDataAdapter adpt1 = new SqlDataAdapter(strCmd, cnn1);
DataSet ds1 = new DataSet();
adpt1.Fill(ds1);
ddlState.Items.Clear();
if (ds1.Tables[0].Rows.Count > 0)
{
ddlState.DataSource = ds1;
ddlState.DataTextField = "Name";
ddlState.DataValueField = "Id";
ddlState.DataBind();
}
ddlState.Items.Insert(0, new ListItem("Select", "-1"));
}
protected void FillCity()
{
string strCmd;
strCmd = "Select * from tblCity where Stateid=" + ddlState.SelectedValue + " order by Name";
SqlDataAdapter adpt1 = new SqlDataAdapter(strCmd, cnn1);
DataSet ds1 = new DataSet();
adpt1.Fill(ds1);
ddlCity.Items.Clear();
if (ds1.Tables[0].Rows.Count > 0)
{
ddlCity.DataSource = ds1;
ddlCity.DataTextField = "Name";
ddlCity.DataValueField = "Id";
ddlCity.DataBind();
}
ddlCity.Items.Insert(0, new ListItem("Select", "-1"));
}
protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)
{
FillState();
FillCity();
ddlCountry.Focus();
}
protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)
{
FillCity();
ddlState.Focus();
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
string strCmd = "";
int i = 0;
strCmd = "Insert into tblUser(FirstName,LastName,Address,Email,Contact,Gender,Country,State,City,Password1,Notification,UserType) "+
"values('" + txtFirstName.Text + "','" + txtLastName.Text + "','" + txtAddress.Text + "','" + txtEmail.Text + "','" + txtContact.Text + "'," +
radGender.SelectedValue + "," + ddlCountry.SelectedItem.Value + "," + ddlState.SelectedItem.Value + "," +
ddlCity.SelectedItem.Value + ",'" + txtPassword.Text + "','" + ChkNotification.Checked + "',"+radUType.SelectedValue + ")";
SqlCommand cmd1 = new SqlCommand(strCmd,cnn1);
cnn1.Open();
i=cmd1.ExecuteNonQuery();
if (i > 0)
{
lblMessage.Text = "You have successfully registered.";
}
else
{
lblMessage.Text = "Error during Registration.";
}
cnn1.Close();
}
protected void ddlCity_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlCity.SelectedIndex > 0)
{
ddlCity.Focus();
}
}
}
Reply
Answers (
1
)
How to create Eventhadler to monitor a Table in DataBase
How to disable the maximize symbol in title bar