473,654 Members | 3,272 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

tab sequence/highlighting/formatting

I'm new to asp.net and is having problems doing the following:

1. The tab sequence in a asp form is not working properly. The page is
a login form and tabindex is set to 0 for username, 1 for passwd and 2
for the submit button but after tabbing from username, the focus jumps
back to the url address bar.

2. I'm trying to format strings displayed through response.write, e.g.
how to make the string bold or centered in page, or make the color
green etc. As a workaround I'm using label controls.

3. May be this is related to the above question. I'm writing the
contents of an array into a multiline textbox, row by row, and
depending on a condition, I want to highlight that row, e.g. if name =
"Michael", highlight, else just write it in the textbox. how to
highlight?

I would really appreciate if someone helps.

thanks

Nov 19 '05 #1
6 1646

1. The tab sequence in a asp form is not working properly. The page is
a login form and tabindex is set to 0 for username, 1 for passwd and 2
for the submit button but after tabbing from username, the focus jumps
back to the url address bar.
Can you post your code so we can try it? Your tabindices look right and ought
to work.
2. I'm trying to format strings displayed through response.write, e.g.
how to make the string bold or centered in page, or make the color
green etc. As a workaround I'm using label controls.
A quick solution is the following

use response.write( "<b>" & "text" & "</b>") for bold
use response.write( "<center>" & "text" & "</center>") to center
use response.write( "<font color=green>" & "text" & "</font>") to make the
color green

But these are not the best ways to do this. If you got some more time dig
into a technique called CSS = Cascading Style Sheets.
3. May be this is related to the above question. I'm writing the
contents of an array into a multiline textbox, row by row, and
depending on a condition, I want to highlight that row, e.g. if name =
"Michael", highlight, else just write it in the textbox. how to
highlight?


You need a listbox for that, not a textbox. Below is some code that will
give you an idea how to proceed. The code was made with asp.net v2 so maybe
you have to make some changes.

<%@ Page Language="VB" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<script runat="server">

Protected Sub ListBox1_DataBo und(ByVal sender As Object, ByVal e As System.EventArg s)
Dim thing As ListItem
For Each thing In ListBox1.Items
If thing.Value.Con tains("a") Then
thing.Selected = True
End If

Next
End Sub
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
&nbsp;&nbsp;
<asp:ListBox ID="ListBox1" runat="server" DataSourceID="S qlDataSource1"
DataTextField=" CategoryName"
DataValueField= "CategoryNa me" OnDataBound="Li stBox1_DataBoun d"
SelectionMode=" Multiple">
</asp:ListBox>
<asp:SqlDataSou rce ID="SqlDataSour ce1" runat="server" ConnectionStrin g="<%$
ConnectionStrin gs:NorthwindCon nectionString1 %>"
SelectCommand=" SELECT [CategoryName] FROM [Alphabetical list
of products]"></asp:SqlDataSour ce>
</div>
</form>
</body>
</html>
Let me know if you have any more questions..

Cheers,
Tom Pester
Nov 19 '05 #2
Thanks ever so much Tom. Your solutions worked like a charm. Thanks for
the pointer to CSS. Here are some more questions:

1. For (1) above, I'm not controlling the tab sequence in code but I've
just set the indices through the properties pane.

2. I used listbox instead of textbox like you mentioned in (3) above
but now I'm not able to format the display in the manner I want. For
example I want to add a heading to my rows in the listbox and I have

Heading = "#" & ControlChars.Ta b & "Items" & ControlChars.Ta b &
ControlChars.Ta b & "Value of Bids"
lstResult.Items .Add(Heading)

In the screen the control chars (the tabs) are all lost and what shows
up is
# Items Value of Bids

3. I want to refresh the display, say every 15 secs and I'm currently
doing it as:

<meta http-equiv="refresh" content="15">

but if the user is in the middle of entering something on the screen,
it's all lost when he gets back control following a refresh from the
server. This is obviously very annoying for the user. Any better way to
do it? like if the form has been idle for 5 secs only then refresh?

4. This is an auction application and I'm trying to display the elapsed
time on the screen. I've saved the StartTime as an application variable
and am calculating the elapsed time as follows:

Dim Start As DateTime
Dim elapsed As TimeSpan

Start = Application("st arttime")

elapsed = Now.Subtract(St art)

ElapsedTime = elapsed.Minutes .ToString & ":" &
elapsed.Seconds .ToString

Now the issue with this implementation is that the elapsed time can
only be incremented when the server is called. If I do it on the client
side by using some javascripts, it becomes dependent on the session.
How can I, may be pass the application start time to the client and
then calculate the elapsed time from the client?

Nov 19 '05 #3
1. For (1) above, I'm not controlling the tab sequence in code but
I've just set the indices through the properties pane.
Can you send the code so I can reproduce?
2. I used listbox instead of textbox like you mentioned in (3) above
but now I'm not able to format the display in the manner I want. For
example I want to add a heading to my rows in the listbox and I have

Heading = "#" & ControlChars.Ta b & "Items" & ControlChars.Ta b &
ControlChars.Ta b & "Value of Bids"
lstResult.Items .Add(Heading)
In the screen the control chars (the tabs) are all lost and what shows
up is
# Items Value of Bids
To solve this particular problem you can use spaces instead of tabs and use
a non-proportional font like Courrier so everythin is alligned well.

I suggested you to use the listbox cause I thought you wanted your user to
select certain items in the list and post the information to the server.

If you just want to higlight some items in a list to emphesize things and
don't need your user to select the items themselves we could better use a
datalist.
You understand the difference?

3. I want to refresh the display, say every 15 secs and I'm currently
doing it as:

<meta http-equiv="refresh" content="15">

but if the user is in the middle of entering something on the screen,
it's all lost when he gets back control following a refresh from the
server. This is obviously very annoying for the user. Any better way
to do it? like if the form has been idle for 5 secs only then refresh?
Why do you want to refresh your page every 15 seconds?

Detecting that a form has been idle is possible with Javascript I guess
but required a bit of code.
If I know why you want to refresh i can come up with a simpler solution maybe.
4. This is an auction application and I'm trying to display the
elapsed time on the screen. I've saved the StartTime as an application
variable and am calculating the elapsed time as follows:


People have encountered such requirments in the paste and made some code
for us ready to use :
http://www.google.com/search?hl=en&l...pt&btnG=Search

There are lots of solutions as you can see. I'm sure there is one that meets
your needs.

Let me know if you have any more questions..

Cheers,
Tom Peste
Nov 19 '05 #4
Thanks again Tom. You are right about the list box. I just need it for
display. So, may be I can use a datalist. Thanks for the poiter to the
javascripts. The tabindex and refresh issues are as follows:

1. About the problem with tabindex, here's the code:
<body bottomMargin="5 " bgProperties="f ixed" bgColor="lavend er"
leftMargin="5" topMargin="10"
rightMargin="5" MS_POSITIONING= "GridLayout ">
<form id="Form1" method="post" runat="server">
<asp:button id="btnLogin" style="Z-INDEX: 101; LEFT: 410px;
POSITION: absolute; TOP: 208px"
runat="server" Font-Names="Verdana" Font-Bold="True" Text="Login"
tabIndex="2"></asp:button><asp :label id="lblPassword " style="Z-INDEX:
105; LEFT: 248px; POSITION: absolute; TOP: 155px"
runat="server" Font-Bold="True" Width="80px" tabIndex="4"
Font-Names="Verdana"
Font-Size="Smaller"> Password:</asp:label><asp: textbox id="txtUsername "
style="Z-INDEX: 103; LEFT: 360px; POSITION: absolute; TOP: 104px"
tabIndex="0" runat="server" Font-Names="Verdana" Width="159"
Height="24"></asp:textbox><as p:label id="lblUsername " style="Z-INDEX:
102; LEFT: 248px; POSITION: absolute; TOP: 108px"
runat="server" Font-Bold="True" Width="80px" tabIndex="3"
Font-Names="Verdana"
Font-Size="Smaller"> Username:</asp:label><asp: textbox id="txtPassword "
style="Z-INDEX: 109; LEFT: 360px; POSITION: absolute; TOP: 152px"
runat="server" Width="159px" TextMode="Passw ord" tabIndex="1"
Height="24px"></asp:textbox><as p:label id="lblMsg" style="Z-INDEX: 107;
LEFT: 560px; POSITION: absolute; TOP: 128px"
runat="server"> </asp:label><asp: checkbox id="chkPersist "
style="Z-INDEX: 108; LEFT: 568px; POSITION: absolute; TOP: 184px"
runat="server" Visible="False" ></asp:checkbox></form>
</body>

2. As I mentioned earlier, this is an experimental auction website, so
I want to refresh the page in order to show the most recent bids. The
auction will be for 15 mnts with potentially heavy bidding. Should I
use a framed page and put the data entry fields and display datalist in
separate frames? So that I can only refresh the frame with the display
field.

Nov 19 '05 #5
1. About the problem with tabindex, here's the code:
Sometimes an error is caused by very little details. If you start your tabindex
at 1 and not 0 I think it will work.
For some reason 0 is a value that internet explorer doesnt like.
2. As I mentioned earlier, this is an experimental auction website, so
I want to refresh the page in order to show the most recent bids. The
auction will be for 15 mnts with potentially heavy bidding. Should I
use a framed page and put the data entry fields and display datalist
in separate frames? So that I can only refresh the frame with the
display field.


A framed page is an idea that could solve the problem.
I generaly dislike frames for several reasons so I would look for another
solution (http://www.useit.com/alertbox/9612.html).

I would use a technique called AJAX. Here you have an article on it http://www.devx.com/webdev/Article/28451/0/page/3
What AJAX does is let the browser retreive information from the server without
refreshing the page and rewritting a section of the page without the user
interupting in his current task.

AJAX can be pretty complicated to master so be prepared for a steep learning
curve.
ASP.NET version 2 implements AJAX through "client script callbacks" as showed
on http://www.devx.com/webdev/Article/28451/0/page/3.
If you use version 1 of ASP.NET check out http://weblogs.asp.net/mschwarz/

Mabye an iframe approuch would also work (http://www.dynamicdrive.com/dynamici...ame-ticker.htm)
but I would go with AJAX.

I hope you don't get lost in AJAX. If you do try the FRAME approuch and see
if you can get a working result.
I hope this helps...

Cheers,
Tom Peste
Nov 19 '05 #6
Tom,

your solution for the tabindexing problem was spot on. I'll try out the
other things you've mentioned. thanks a bunch.

pallab

Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7911
by: Mark | last post by:
Hi there, I have a subform, set as a continuous form. When a user selects a particular record in that subform, how can I make that particular record stand out (color or font change, size, etc) from the other records in the list? Thank you in advance, Mark
9
6060
by: PeteCresswell | last post by:
I've got a continuous form that is a grid of statistical values. When the user clicks on a statistic, something happens (specifically a graph is created showing rolling one-year values for the stat in question). What I'd like to do is have the current cell highlighted somehow so its clearer which statistic is "current". MouseOver doesn't seem to be an option because the form is continuous
4
4716
by: windandwaves | last post by:
Hi Folk Is there anyone out there who knows if there is an easy way to highlight the currentrecord using conditional formatting or something like that in Access 2003? Thank Nicolaas
2
4739
by: Johnny | last post by:
Sorry I posted this post earlier but got the name and subject the wrong way round (new to this!) so it perhaps didn't look right Sorry for that. But please please answer if you know anything about it.. Thanks I've got a procedure that is responsible for performing the following operations on a richtextbox 1) determining what parts of the text to forma 2) formatting specific ranges of text a specific color I need to do this whenever the...
4
2791
by: Patrick Porter | last post by:
Arrrgh! I have tried everything (ok, not EVERYTHING) but i cant get solve the problem of getting syntax highlighting in a rich textbox. in the code below, im attempting to highlight all of the words "ax". the matches works fine, but i cant get the highlighting to work correctly. any help? thanks, patrick Private Sub rtbCode_TextChanged(ByVal sender As System.Object, ByVal e As
3
1524
by: Patrick Porter | last post by:
I am looking at followin the suggestion made by Larry on my last post. (his reply is on the bottom) it seems that you can't directly mess with the rich text header text....specifically the addtion of the colortable (which defines which colors can be used) rtbCode.Rtf.Insert(10,"{\colortbl ;\red255\green0\blue0;\red0\green0\blue255;}") does nothing. neither does rewrting the entire header each time.... why is this? In order
4
6094
by: lord.zoltar | last post by:
I am wondering how you guys highlight cells or rows (by changing the text or background colour) in a DataGridView. Right now, I apply styles to certain rows or cells in the CellFormatting even handler, but the way it works is by looping through all of the rows and then deciding if that rows needs special formatting. The problem is that I don't think this method will scale well. I have a dataset with 5,000 rows (and others are larger, this...
4
2679
by: frikker | last post by:
Hello, I have an idea for a project which involves an editor that supports syntax highlighting. This would be for any language, particularly php, html, css, etc. I would like to write this program using python. It would only make sense to base this upon existing open source code. My question is there a python module or examples on how to write a code editor which supports modulated syntax highlighting? Thank you, Blaine
1
2535
by: Gord | last post by:
Using VB, when records are brought up in datasheet view (either a query or table), is it possible to highlight (or in some way visually flag) certain records? If so, how is this 'highlighting' accomplished? Note that the records would most likely not be contiguous. The purpose being to bring those records to the users attention when required. Thanks, Gord
0
8379
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...
1
8494
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
7309
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
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
5627
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
4150
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...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
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
1924
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.