473,407 Members | 2,326 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Ado Paging

Ranjan kumar Barik
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.
Sep 8 '07 #1
5 1238
jhardman
3,406 Expert 2GB
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.
Expand|Select|Wrap|Line Numbers
  1. dim colorDeclaration
  2. do until rs.eof
  3.    response.write "<tr><td"
  4.    if rs("prodID") = session("lastSavedData") then
  5.       colorDeclaration = " style='color: red;'"
  6.    else
  7.       colorDeclaration = ""
  8.    end if
  9.    response.write colorDeclaration & ">" & rs("prodID") & "</td>" & vbNewLine
  10.    response.write "<td" & colorDeclaration & ">" & rs("prodDescription") & "</td>" & vbNewLine
  11.    response.write "<td" & colorDeclaration & ">" & rs("prodPrice") & "</td></tr>" & vbNewLine
  12.    rs.movenext
  13. loop
Is this the kind of thing you want?

Jared
Sep 10 '07 #2
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

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head></head>
  3. <body>
  4.  
  5. <%
  6. set conn = createObject("adodb.connection")
  7. conn.provider = "Microsoft.jet.oledb.4.0"
  8. conn.open "c:/inetpub/wwwroot/Ranjan/test.mdb"
  9.  
  10. set rs = createObject("adodb.recordset")
  11. rs.open "select * from TblStudent",conn
  12. %>
  13.  
  14.  
  15. <table border = "0" width="100%" bgcolor="#000000">
  16. <%do until rs.EOF
  17.     dim i,r,color
  18.     r = i mod 2
  19.     if r = 0 then
  20.         color = "#00FFFF"
  21.     else
  22.         color = "#FFFFFF"
  23.     end if
  24. %>
  25.   <tr>
  26.     <td bgcolor=<%=(color)%>><%response.write(rs.fields("StudentId"))%></td>
  27.     <td bgcolor=<%=(color)%>>
  28.         <%
  29.             if session("lastSavedData") = rs.fields("FirstName")  then
  30.                 response.write("<font color=#FF0000>" & rs.fields("FirstName") & "</font>")
  31.             else
  32.                 response.write(rs.fields("FirstName"))
  33.             end if
  34.         %>
  35.     </td>
  36.     <td bgcolor=<%=(color)%>><%response.write(rs.fields("MiddleName"))%></td>
  37.     <td bgcolor=<%=(color)%>><%response.write(rs.fields("City"))%></td>
  38.     <td bgcolor=<%=(color)%>><%response.write(rs.fields("PhoneNumber"))%></td>
  39.     <td bgcolor=<%=(color)%>><%response.write(rs.fields("AdvisorNumber"))%></td>
  40.   </tr>
  41.     <%rs.moveNext
  42.     i = i+1
  43.     loop
  44.     rs.close
  45.     conn.close
  46.     %>
  47. </table>
  48.  
  49. </body>
  50. </html>
Only a perticular FirstName like "Ranjan" will appear red !!!
I have tried session("lastSavedData") = Ranjan but it won't work.

Thankss!!!!!!!
Sep 11 '07 #3
jhardman
3,406 Expert 2GB
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:
Expand|Select|Wrap|Line Numbers
  1. 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
Sep 11 '07 #4
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:
Expand|Select|Wrap|Line Numbers
  1. 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:

Expand|Select|Wrap|Line Numbers
  1. rs.fields("FirstName") = "Ranjan"
Ihave tried this before but without --""-- around Ranjan.

ok. Its fine now.
Thank you.

Thanks.
Sep 12 '07 #5
jhardman
3,406 Expert 2GB
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:
Expand|Select|Wrap|Line Numbers
  1. 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
Sep 13 '07 #6

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

Similar topics

0
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...
2
by: RelaxoRy | last post by:
sqlConnection1.Open(); myReader = sqlCommand1.ExecuteReader(); DataGrid1.DataSource = myReader; DataGrid1.DataBind(); myReader.Close(); sqlConnection1.Close(); The Datagrid populates fine. ...
1
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...
6
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...
2
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
2
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...
0
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...
2
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...
3
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...
5
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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,...
0
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...
0
Oralloy
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,...
0
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...
0
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...
0
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,...
0
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...

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.