473,397 Members | 2,099 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,397 software developers and data experts.

How would you do this, what control?

I'm new to ASP.NET and CSharp, I'm making the SLOW transition from classic ASP. I am truly amazed by the robustness of the new environment. However, I ran into a small problem. Before in ASP, I would create a loop below:

do while not rs.eof
<a href="myPage.asp?ID=<%=rs("myID")%<%=rs("Title")%> </a>
movenext
loop

But now with .NET not sure what tool to use and how to use it. Would you care to offer any advice? Thanks ahead of time.
Apr 27 '07 #1
5 1207
Shawn,

You can do the same thing in ASP.NET. There is nothing stopping you from executing a for loop and writing to the response stream with what would be almost the same syntax (changed for the C# language, if that is what you are using on the code behind).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Shawn Ferguson" <SF******@cscc.eduwrote in message news:46******************@cscc.edu...
I'm new to ASP.NET and CSharp, I'm making the SLOW transition from classic ASP. I am truly amazed by the robustness of the new environment. However, I ran into a small problem. Before in ASP, I would create a loop below:

do while not rs.eof
<a href="myPage.asp?ID=<%=rs("myID")%<%=rs("Title")%> </a>
movenext
loop

But now with .NET not sure what tool to use and how to use it. Would you care to offer any advice? Thanks ahead of time.
Apr 27 '07 #2
On Apr 27, 11:36 am, "Shawn Ferguson" <SFerg...@cscc.eduwrote:
I'm new to ASP.NET and CSharp, I'm making the SLOW transition from classic ASP. I am truly amazed by the robustness of the new environment. However, I ran into a small problem. Before in ASP, I would create a loop below:

do while not rs.eof
<a href="myPage.asp?ID=<%=rs("myID")%<%=rs("Title")%> </a>
movenext
loop

But now with .NET not sure what tool to use and how to use it. Would you care to offer any advice? Thanks ahead of time.
One possible solution is the RepeaterControl (<asp:Repeater
Id="Myrepeater" />). You basically create the control and a template,
and in your .cs code behind fine (definately go with the code behind
route), you would so something like this:

Myrepeater.DataSource = rs; // Where rs is an IDataReader, such as
SqlDataReader for Sql server

And you're done! Mostly..

Apr 27 '07 #3
There isn't a "new and improved" method of accomplishing it using the newer controls?
Apr 27 '07 #4
Shawn,
Not sure if this is really a "C# Language" group post, it probably ought to
have been in the ASP.NET group. As Nick indicated, you can certainly use the
same style of loop and Response.Write 's as classic ASP.

However, ASP.NET offers controls such as the Repeater that make this
effortless.

Take a look at the QUICKSTARTS:

http://quickstarts.asp.net/QuickStar...c/default.aspx

This is the best place to start when you are a "n00b" (which we all were,
once...)
Peter
--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Shawn Ferguson" wrote:
I'm new to ASP.NET and CSharp, I'm making the SLOW transition from classic ASP. I am truly amazed by the robustness of the new environment. However, I ran into a small problem. Before in ASP, I would create a loop below:

do while not rs.eof
<a href="myPage.asp?ID=<%=rs("myID")%<%=rs("Title")%> </a>
movenext
loop

But now with .NET not sure what tool to use and how to use it. Would you care to offer any advice? Thanks ahead of time
Apr 27 '07 #5
You could use a Repeater control, and then create an ItemTemplate for the repeater and populate it using a data reader (don't load the whole data set, there is no point here unless you need to use it elsewhere).
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Shawn Ferguson" <SF******@cscc.eduwrote in message news:46******************@cscc.edu...
There isn't a "new and improved" method of accomplishing it using the newer controls?
Apr 27 '07 #6

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

Similar topics

5
by: Paul Mendez | last post by:
I am creating a form with a tab control containing 10 tabs. and what I want to do is on only on of the tabs, I want a sub section of tabs. So what it ends up being is one main tab control with...
0
by: Björn Marthen | last post by:
Hello, I wrote two custom controls. The first control (dbconnection) inherits from "System.ComponentModel.Component" and has the properties for the database connection. The second control...
1
by: Wannabe_Geek | last post by:
Hi Iam new to MS .Net technology just getting along with it....I created a custom control ,which takes in a query and displays the data in a tabular format....something similar to a datagrid. ...
4
by: Moe Sizlak | last post by:
Hi There, I am trying to return the value of a listbox control that is included as a user control, I can return the name of the control but I can't access the integer value of the selected item,...
1
by: olduncleamos | last post by:
Hello all, I am experimenting with the repeater control and ran into something that I wasn't expecting. I would appreciate if the experts can confirm or correct my understanding. Here is a...
5
by: serge calderara | last post by:
Dear all, I am new in asp.net and prepare myself for exam I still have dificulties to understand the difference between server control and HTML control. Okey things whcih are clear are the fact...
0
by: Chubby Arse | last post by:
Hi all, I have a control, that basically is my own version of the datagrid, except that is renderers purely readonly tabular information. When the control is rendered to the designer, I can...
0
by: Qwert | last post by:
Heya, I have a user control (inherits from listview control). I add a textbox control to it as a child control and give the child control the focus. All is well when I type text (keyboard input)...
3
by: funkyMonkey | last post by:
I'm binding date fields from entity objects and formatting the output in the text box in short date format. Code: BindDateField(Me.txtCheckIn, "Text", reservation.BookingDetail, "CheckIn")...
7
by: Jonas | last post by:
Hi. I'm trying to develop a web custom control that uses a programmatically created treeview. My problem is that I get an exception when I try to render the control. With properties do I have to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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:
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
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...
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.