Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Horizontal List

Status
Not open for further replies.

jedel

Programmer
Jan 11, 2003
430
AU
OK,

I humbly apologize if this question is already answered in another post, but I am a total beginer with ASP.NET. I do have HTML, ASP, and VB coding experience, but I really don't know the terminology to look for a solution so its best if I show you what I'm after.

If you could take a second and go to this webpage:


At the bottom of this page you will see a list of events spanning across the bottom of the page. These events are based on selection for the database, are in date order, and most importantly span across the page.

This is in ASP, how can I acheive this effect in ASP.net?

Please bear with me as I will probably need a lot of assistance in this as I am trying to learn ASP.NET on the fly. It is coming together albeit slowly.

Cheers

Dean

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
if your talking asp.net as in webforms then the're are web controls like repeater which you can use to create repeated data. Most (all) styling should be handled by css anyway.

if your talking asp.net using another model (monorail, ms mvc) then it's just html.

Side notes:
asp.net web forms makes html more complicated than it needs to be. This is "good" if you are not fluent in html, css, js.
If you understand html, css and js, then this is cumbersome. You know the html you want, but the controls are rendering it for you.

asp.net is a framework for handling requests/responses.
WebForms is an html rendering engine which uses asp.net. it's also the most common engine thanks to MS.
MonoRail uses asp.net. it does not use webforms. at least not in the traditional sense of webforms.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Thanks for the info. MS usually does over complicate things. But at this point of my learning, I'm just going with the GUI way until I can see the code to understand it.

So the repeater is the way to go? So how does this work? I've tried adding a repeater but get errors.

-------------------------------------------------------------
"The most overlooked advantage of owning a computer is that if they foul up there's no law against whacking them around a bit."
 
drag a repeater control on to the webform. a repeater is a blank slate for rendering enumerated data. (Where as the gridview outputs a table.)
right click to edit the different templates
Header
Footer
Item
Alternate Item

In the code behind you will need to bind your data to the repeater. A common place for this is the Load event
Code:
protected void Page_Load(object sender, EventArgs e)
{
   if(!IsPostback)
   {
      NameOfRepeaterInstance.DataSource = GetData();
      NameOfRepeaterInstance.DataBind();
   }
}

private IEnumerable GetData()
{
   //code to return enumerated data.
   //could be a List<>, array[], DataTable, DataSet, etc.
}
The IsPostback flag is unique to the webforms model. If you have viewstate enable (default) then you only need to bind on the initial page load, you do not need to bind on subsequent postbacks.

I would avoid any sort of DataSource control. They make debugging and maintenance a nightmare.

There are also alot of examples online. google" asp.net repeater web control" to get started.

Before you go much further I would also recommend learning the "asp.net page life cycle" this is important to understand when designing webpages using webforms.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top