473,626 Members | 3,063 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Scrolling a list box with up and down arrow

375 Contributor
Hello
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
  1. protected void Page_Load(object sender, EventArgs e)
  2.     {
  3.         if (!Page.IsPostBack)
  4.         {
  5.  
  6. MyCon.Open();
  7.               SqlDataAdapter MyDa = new SqlDataAdapter("select registrationno,gps_datetime from gpsdata ", MyCon);
  8.         DataSet MyDs = new DataSet();
  9.         MyDa.Fill(MyDs, "IpAddress");
  10.         MyCon.Close();
  11.         int CheckCount = (MyDs.Tables["IpAddress"].Rows.Count);
  12.         for (int i = 0; i < CheckCount; i++)
  13.         {           
  14.                             lstRegno.Items.Add(MyDs.Tables["IpAddress"].Rows[i][0].ToString());
  15.         }
  16.  
  17.     }
  18.     }
  19.  
  20.  
  21. protected void lstRegno_SelectedIndexChanged(object sender, EventArgs e)
  22.     {
  23.         MyCon.Open();
  24.         string SelectedRegno = lstRegno.SelectedValue.ToString();
  25.         SqlDataAdapter MyDa1 = new SqlDataAdapter("select unit_no,latitude,longitude,speed,gps_datetime,logic_state,ignition,location from gpsdata where registrationno='" + SelectedRegno + "'", MyCon);
  26.         DataTable MyDt1 = new DataTable();
  27.         MyDa1.Fill(MyDt1);
  28.         MyCon.Close();
  29.         txtRegNo.Text = SelectedRegno.ToString();
  30.         txtUnitNo.Text = MyDt1.Rows[0][0].ToString();
  31.         txtLat.Text = MyDt1.Rows[0][1].ToString();
  32.         txtLong.Text = MyDt1.Rows[0][2].ToString();
  33.         txtSpeed.Text = MyDt1.Rows[0][3].ToString();
  34.         string dat = MyDt1.Rows[0][4].ToString();
  35.         txtGpsDateTime.Text = (Convert.ToDateTime(dat)).ToString("MM/dd/yyyy HH:mm:ss");
  36.         txtIpAddress.Text = MyDt1.Rows[0][5].ToString();
  37.         txtIgnition.Text = MyDt1.Rows[0][6].ToString();
  38.         txtLocation.Text = MyDt1.Rows[0][7].ToString();
  39.     }
Thanks and regards
cmrhema
Sep 17 '07 #1
0 1773

Sign in to post your reply or Sign up for a free account.

Similar topics

9
6222
by: johkar | last post by:
I only have IE 6 and dial-up. Can you help me determine which browsers support this code? Thanks, John <html> <head> <title>Fixed Table Headers</title> <script language="JavaScript" type="text/javascript"> function fix(){
14
5412
by: Dave | last post by:
My web site is not particularly theme-based, but it contains an Art Gallery I'd like to display in a different perspective. I would like to horizontally scroll it, rather than vertically - as if the viewer is virtually "walking" through the gallery. I'm just attempting this to have this part of the page be different. Is horizontal scrolling okay, or will it throw our browsers into chaos and viewers into insanity? If horizontal scrolling...
1
5630
by: dschectman | last post by:
I have an interesting issue. I need to implement a dynamic table to mimic a select list. Each time you double click from the master list, a row is added to the list of selected items. The list of selected items has a column header and differentiation between odd and even rows. This part is trivial. Clients have the ability to re-order the list of selected items. This is also trivial: I trap the onClick event for a row to select it. ...
1
1159
by: Tom | last post by:
I have tried all the solutions I have found on the web, including the syncfusion solutions I can get the combobox on the grid ok, but it does not behave like a regular combobox Example On a form, you can tab to a combobox, F4 to dropdown, up/down arrow to scroll, and Enter to select choice On a datagrid I can get it so F4 opens the dropdown, but up/down arrow moves to the adjacent cel in the datagrid instead of scrolling within the...
2
5954
by: gv | last post by:
Hi all, Using VB 2005 Express When pressing the down key in a listbox and getting to the last item I want to move right back to the top and vise versa so it never stops when pressing the arrow keys. The code below moves it when it gets to the end of the list biut skips the first item
0
1316
by: Tom | last post by:
In the old VS 2003 Menu bar, it would scroll the list if it extended beyond the end of the screen (i.e. you had 60 reports in a menu and it displayed the little down-arrow at the end of the dropped-down menu list) and you tapped the first letter of a menu item. However, it appears that the new VS 2005 menu strip doesn't do this - i.e. I have a menu that has quite a few items in it; when it is dropped down and it extends beyond the end of...
3
1669
by: bhuvragu | last post by:
Hi , I am new to html_ajax which is part of PEAR package. I have created a demo on html_ajax. Demo is when the user types text in a text field, it would display the relevant matching words and display as drop down list.. as like google suggest. when the user mouse over the div elements (that is list of words shown as drop down list) , it will highlight the word in blue color. The user can select the word also using mouse.. what i...
13
8735
by: andypb123 | last post by:
Hello, The onchange event fires in IE6 in a SELECT element when scrolling through the list with the up and down arrows on the keyboard. In Firefox it only fires after you hit the enter key, which is the behaviour I want make happen in IE. Does anyone know how to accomplish this? Thanks a lot Andy Birchall
8
3363
by: rmurgia | last post by:
Has anyone noticed that scrolling through objects i.e. forms, reports, tables, etc with Access 2007 is not as easy as Access 2003? I have a database with a large number of objects. When scrolling through with the down arrow or page down, it seems that items get caught in the buffer making scrolling through large amounts of objects cumbersome. After taking my finger off the key, the cursor continues to move. If I push down and let go quickly,...
0
8262
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8637
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8364
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8502
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6122
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5571
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4090
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2623
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.