Hi !!!
I am using a recordset and I want
that when i prodduce the data in an html page in a table format using asp
a particular field will appear red.
5 1238
Hi !!!
I am using a recordset and I want
that when i prodduce the data in an html page in a table format using asp
a particular field will appear red.
- dim colorDeclaration
-
do until rs.eof
-
response.write "<tr><td"
-
if rs("prodID") = session("lastSavedData") then
-
colorDeclaration = " style='color: red;'"
-
else
-
colorDeclaration = ""
-
end if
-
response.write colorDeclaration & ">" & rs("prodID") & "</td>" & vbNewLine
-
response.write "<td" & colorDeclaration & ">" & rs("prodDescription") & "</td>" & vbNewLine
-
response.write "<td" & colorDeclaration & ">" & rs("prodPrice") & "</td></tr>" & vbNewLine
-
rs.movenext
-
loop
Is this the kind of thing you want?
Jared
Is this the kind of thing you want?
Hi jhardman !!
The code just makes the hole column red !!!!!!
I want to make only a perticular value of that coloumn red
You please take a look at the code - <html>
-
<head></head>
-
<body>
-
-
<%
-
set conn = createObject("adodb.connection")
-
conn.provider = "Microsoft.jet.oledb.4.0"
-
conn.open "c:/inetpub/wwwroot/Ranjan/test.mdb"
-
-
set rs = createObject("adodb.recordset")
-
rs.open "select * from TblStudent",conn
-
%>
-
-
-
<table border = "0" width="100%" bgcolor="#000000">
-
<%do until rs.EOF
-
dim i,r,color
-
r = i mod 2
-
if r = 0 then
-
color = "#00FFFF"
-
else
-
color = "#FFFFFF"
-
end if
-
%>
-
<tr>
-
<td bgcolor=<%=(color)%>><%response.write(rs.fields("StudentId"))%></td>
-
<td bgcolor=<%=(color)%>>
-
<%
-
if session("lastSavedData") = rs.fields("FirstName") then
-
response.write("<font color=#FF0000>" & rs.fields("FirstName") & "</font>")
-
else
-
response.write(rs.fields("FirstName"))
-
end if
-
%>
-
</td>
-
<td bgcolor=<%=(color)%>><%response.write(rs.fields("MiddleName"))%></td>
-
<td bgcolor=<%=(color)%>><%response.write(rs.fields("City"))%></td>
-
<td bgcolor=<%=(color)%>><%response.write(rs.fields("PhoneNumber"))%></td>
-
<td bgcolor=<%=(color)%>><%response.write(rs.fields("AdvisorNumber"))%></td>
-
</tr>
-
<%rs.moveNext
-
i = i+1
-
loop
-
rs.close
-
conn.close
-
%>
-
</table>
-
-
</body>
-
</html>
Only a perticular FirstName like "Ranjan" will appear red !!!
I have tried session("lastSavedData") = Ranjan but it won't work.
Thankss!!!!!!!
Hi jhardman !!
The code just makes the hole column red !!!!!!
I want to make only a perticular value of that coloumn red
You please take a look at the code
Only a perticular FirstName like "Ranjan" will appear red !!!
I have tried session("lastSavedData") = Ranjan but it won't work.
Thankss!!!!!!!
Please enclose your code within code tags (notice the button marked -- # -- when you go to post) Also it is a pet peave of mine (something that really annoys me) to see multiple exclamation points (or question marks) at the end of a sentence. It is never correct in English and I would only use it when I'm making fun of the way other people write.
About your question, this should definitely work except put the "dim i, r, color" line before the do ... loop. Also put this: - session("lastSavedData") = "Ranjan"
before the do ... loop and it should work. If it doesn't work, please tell me how. Is it showing nothing, is it giving you an error message or does the color turn the wrong color? Saying it doesn't work doesn't tell me much.
Jared
Please enclose your code within code tags (notice the button marked -- # -- when you go to post) Also it is a pet peave of mine (something that really annoys me) to see multiple exclamation points (or question marks) at the end of a sentence. It is never correct in English and I would only use it when I'm making fun of the way other people write.
About your question, this should definitely work except put the "dim i, r, color" line before the do ... loop. Also put this: - session("lastSavedData") = "Ranjan"
before the do ... loop and it should work. If it doesn't work, please tell me how. Is it showing nothing, is it giving you an error message or does the color turn the wrong color? Saying it doesn't work doesn't tell me much.
Jared
Hi Jared !
First of all I beg sorry.
Next time I will take care of those extra exclamation marks.
And thank u for telling me about the --#-- .
I really didn't know about that.
Ok.
I have tried your code but it showed an error that "the loop expected".
May there be some mistakes in my code !
Still I thank u, because from ur code I got the idea to write the code like this: - rs.fields("FirstName") = "Ranjan"
Ihave tried this before but without --""-- around Ranjan.
ok. Its fine now.
Thank you.
Thanks.
Hi Jared !
First of all I beg sorry.
Next time I will take care of those extra exclamation marks.
And thank u for telling me about the --#-- .
I really didn't know about that.
I'm sorry if I came over a little gruff last time, I was low on patience.
Ok.
I have tried your code but it showed an error that "the loop expected".
May there be some mistakes in my code !
this cold be that the "do" or "loop" line made it outside of the asp code delimiters <% and %>. Show me how it looks and I will try to see any problem there might be.
Still I thank u, because from ur code I got the idea to write the code like this: - rs.fields("FirstName") = "Ranjan"
I have tried this before but without --""-- around Ranjan.
ok. Its fine now.
Thank you.
Thanks.
Glad that worked for you.
Jared
Sign in to post your reply or Sign up for a free account.
Similar topics
by: ck388 |
last post by:
For some reason when I enable the callback feature of the gridview I
still get a page refresh, that is it seems like there is a postback
that occurs, not a callback which is just supposed to update...
|
by: RelaxoRy |
last post by:
sqlConnection1.Open();
myReader = sqlCommand1.ExecuteReader();
DataGrid1.DataSource = myReader;
DataGrid1.DataBind();
myReader.Close();
sqlConnection1.Close();
The Datagrid populates fine. ...
|
by: Guoqi Zheng |
last post by:
Sir,
The default paging of datagrid is somehow use too much resource, so I am
using Stored procedure for the paging. You can find my Stored procedure at
the end of this message.
It works...
|
by: Shawn |
last post by:
Hi.
I already have a datagrid where I'm using paging. I have a stored procedure
that fills a temp table with 200-500 rows and then sends back 10 records at
the time. When I go to page 2 the SP...
|
by: asad |
last post by:
Hello friends, i am designing a ASP.NET page where i want to use custom
paging bcoz data is too heavy so pls tell me how can i use custom paging in
ASP.NET
Thanks
|
by: farhad13841384 |
last post by:
Hi , I Hope You fine.
I have some problem with this code for paging in asp.net
this bottom code work correctly without any error but when
I try to place separate code in .VB file then error is...
|
by: anonieko |
last post by:
This approach I found very efficient and FAST when compared to the
rowcount, or Subquery Approaches.
This is before the advent of a ranking function from DB such as
ROW_NUMBER() in SQL Server...
|
by: rn5a |
last post by:
In a shopping cart app, a ASPX page retrieves the order details &
personal details of a user from a MS-Access database table depending
upon the username of the user.
The order details of a...
|
by: Ronald S. Cook |
last post by:
I was told that if calling lots of records from the database (let's say
100,000), that the GridView's paging feature would automatically "handle"
everything.
But the 100,000 records are still...
|
by: Donald Adams |
last post by:
Hi,
I will have both web and win clients and would like to page my data. I
could not find out how the datagrid control does it's paging though I did
find some sample code that says they do it...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
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,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
|
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,...
|
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...
| |