I am using ASP.net 2.0 with VC# 2005.
I have populated a listbox as below and when I click on the value on the list box I display out the related values. All works fine. But I have one problem. Now i "CLICK" on a particular value on a listbox and display the results. What i need
is to scroll down using up and down arrow(because there are many items in the list box). But my up and down arrow does not move in the list box.I am using DataList control and not html select Can anyone let me know the reason why I cannot move the arrow keys.
Expand|Select|Wrap|Line Numbers
- protected void Page_Load(object sender, EventArgs e)
- {
- if (!Page.IsPostBack)
- {
- MyCon.Open();
- SqlDataAdapter MyDa = new SqlDataAdapter("select registrationno,gps_datetime from gpsdata ", MyCon);
- DataSet MyDs = new DataSet();
- MyDa.Fill(MyDs, "IpAddress");
- MyCon.Close();
- int CheckCount = (MyDs.Tables["IpAddress"].Rows.Count);
- for (int i = 0; i < CheckCount; i++)
- {
- lstRegno.Items.Add(MyDs.Tables["IpAddress"].Rows[i][0].ToString());
- }
- }
- }
- protected void lstRegno_SelectedIndexChanged(object sender, EventArgs e)
- {
- MyCon.Open();
- string SelectedRegno = lstRegno.SelectedValue.ToString();
- SqlDataAdapter MyDa1 = new SqlDataAdapter("select unit_no,latitude,longitude,speed,gps_datetime,logic_state,ignition,location from gpsdata where registrationno='" + SelectedRegno + "'", MyCon);
- DataTable MyDt1 = new DataTable();
- MyDa1.Fill(MyDt1);
- MyCon.Close();
- txtRegNo.Text = SelectedRegno.ToString();
- txtUnitNo.Text = MyDt1.Rows[0][0].ToString();
- txtLat.Text = MyDt1.Rows[0][1].ToString();
- txtLong.Text = MyDt1.Rows[0][2].ToString();
- txtSpeed.Text = MyDt1.Rows[0][3].ToString();
- string dat = MyDt1.Rows[0][4].ToString();
- txtGpsDateTime.Text = (Convert.ToDateTime(dat)).ToString("MM/dd/yyyy HH:mm:ss");
- txtIpAddress.Text = MyDt1.Rows[0][5].ToString();
- txtIgnition.Text = MyDt1.Rows[0][6].ToString();
- txtLocation.Text = MyDt1.Rows[0][7].ToString();
- }
cmrhema