473,761 Members | 4,407 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datagrid/list vs. roll-your-own ASP templates?

I'm new to ASP in general. Have been doing a bunch of stuff using classic
ASP and a bit of stuff with ASP.NET (all with VBscript).

The .NET stuff i've been doing has been fairly simple...genera ting a report
from an Access table. The Datagrid along with some TemplateColumns seemed to
work well for that.

I'm not needing to now pull data from our Homemade CMS database to present
on our public site.

Datagrids and lists don't seem appropriate for this. They seem great for
whipping out quick data views, but seem really limited when it comes to
tweaking the display to include CSS, accessibility tags and attributes, and
formatting.

I need to spit out some content in this format:

[get the last 4 items from the newsitem table and use the template below]

<div class="newsitem ">
<span class="date">[get the date and put it here]</span>
<h3>[get the date]</h3>
<p>[get the first 40 words]</p>
<p class="moreLink "><a>View More</a></p>
</div>

When I need something like this, are there any server controls I should look
at, or should I forget that and just go back to using inline ASP if/then
loops with a lot of response.write' s to generate the wrapping HTML?

Actually, to simplify the question:

When should I use server controls vs. hand-rolled ASP templates?

-Darrel
Nov 18 '05 #1
5 1349
Try Repeater Web server control.
The Repeater Web server control is a data-bound container
control that produces a list of individual items. You
define the layout of individual items on a Web page using
templates.
http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpgenref/html/cpconrepeaterwe bservercontrol. asp

Bin Song, MCP
-----Original Message-----
I'm new to ASP in general. Have been doing a bunch of stuff using classicASP and a bit of stuff with ASP.NET (all with VBscript).

The .NET stuff i've been doing has been fairly simple...genera ting a reportfrom an Access table. The Datagrid along with some TemplateColumns seemed towork well for that.

I'm not needing to now pull data from our Homemade CMS database to presenton our public site.

Datagrids and lists don't seem appropriate for this. They seem great forwhipping out quick data views, but seem really limited when it comes totweaking the display to include CSS, accessibility tags and attributes, andformatting.

I need to spit out some content in this format:

[get the last 4 items from the newsitem table and use the template below]
<div class="newsitem ">
<span class="date">[get the date and put it here]</span>
<h3>[get the date]</h3>
<p>[get the first 40 words]</p>
<p class="moreLink "><a>View More</a></p>
</div>

When I need something like this, are there any server controls I should lookat, or should I forget that and just go back to using inline ASP if/thenloops with a lot of response.write' s to generate the wrapping HTML?
Actually, to simplify the question:

When should I use server controls vs. hand-rolled ASP templates?
-Darrel
.

Nov 18 '05 #2
I battle with this alot myself and am by no means a master of this, but I
can tell you some things that I know (also being an old ASP/VB programer
since 4.0 :) )

For attaching style sheets to a grid control, look around for the cssclass
command of the control (<asp:datagrid cssclass=<name> >). This will allow
you to get the look that you want by attaching CSS files to your grids.

If you really want to 'take it up a notch', think about using XML/XSL and
other related technologies to do your pages. If you get the huge MS-Press
book on XML they go through everything you need to know in there. But be
warned: it is not for the newbies and took me months to figure out how to
put it all together to build an app. Also, I am still having problems with
the XML techniques when it comes to the display of certain data in the grids
(ie. appostrofies in names and other special characters). Also, I found an
XML solution to be harder to support because of the extra levels that need
to be worked out, which adds complication to the app. The programmers that
I work with are less experienced than I am and they can never troublshoot
the XML stuff because it is too complex for them to follow. This creates
great job security, but also alot of headaches because I am the only one
that can work on certain apps.

I hope this helps. Maybe others have ideas too. All the best to you!

Scott

"darrel" <no*****@hotmai l.com> wrote in message
news:Ok******** ******@TK2MSFTN GP12.phx.gbl...
I'm new to ASP in general. Have been doing a bunch of stuff using classic
ASP and a bit of stuff with ASP.NET (all with VBscript).

The .NET stuff i've been doing has been fairly simple...genera ting a report from an Access table. The Datagrid along with some TemplateColumns seemed to work well for that.

I'm not needing to now pull data from our Homemade CMS database to present
on our public site.

Datagrids and lists don't seem appropriate for this. They seem great for
whipping out quick data views, but seem really limited when it comes to
tweaking the display to include CSS, accessibility tags and attributes, and formatting.

I need to spit out some content in this format:

[get the last 4 items from the newsitem table and use the template below]

<div class="newsitem ">
<span class="date">[get the date and put it here]</span>
<h3>[get the date]</h3>
<p>[get the first 40 words]</p>
<p class="moreLink "><a>View More</a></p>
</div>

When I need something like this, are there any server controls I should look at, or should I forget that and just go back to using inline ASP if/then
loops with a lot of response.write' s to generate the wrapping HTML?

Actually, to simplify the question:

When should I use server controls vs. hand-rolled ASP templates?

-Darrel

Nov 18 '05 #3
> For attaching style sheets to a grid control, look around for the cssclass
command of the control (<asp:datagrid cssclass=<name> >). This will allow
you to get the look that you want by attaching CSS files to your grids.
But isn't a grid inherently a table? That's one of the problems I'm finding.
I'm really trying to move our site towards less tables and more CSS for a
variety of reasons. ASP.NET seems to be a bit of a hindrance in that regard.
If you really want to 'take it up a notch', think about using XML/XSL and
other related technologies to do your pages.
Yea, that's probably taking it up too many notches for now ;o)
This creates
great job security, but also alot of headaches because I am the only one
that can work on certain apps.
Ha! Yea, that's a tough one ;o)
I hope this helps. Maybe others have ideas too. All the best to you!


And thanks for the info!

-Darrel
Nov 18 '05 #4
> Try Repeater Web server control.

Hmm...that looks promising. Thanks for the info on that...off to read for a
bit!...

-Darrel
Nov 18 '05 #5
The other guys' reponses are good ones ... here is yet another option to
consider. I use the classes below instead of Response.Write( "my html goes
here"); .... works pretty well. I don't use css much but I imagine it can
be incorporated as you might hope it does.

HtmlTable class
HtmlTableRowCol lection
HtmlTableRow
HtmlTableCell

Then add these to a PlaceHolder control or similar on your page.

HTH,
mark
www.dovetaildatabases.com

"darrel" <no*****@hotmai l.com> wrote in message
news:Ok******** ******@TK2MSFTN GP12.phx.gbl...
I'm new to ASP in general. Have been doing a bunch of stuff using classic
ASP and a bit of stuff with ASP.NET (all with VBscript).

The .NET stuff i've been doing has been fairly simple...genera ting a report from an Access table. The Datagrid along with some TemplateColumns seemed to work well for that.

I'm not needing to now pull data from our Homemade CMS database to present
on our public site.

Datagrids and lists don't seem appropriate for this. They seem great for
whipping out quick data views, but seem really limited when it comes to
tweaking the display to include CSS, accessibility tags and attributes, and formatting.

I need to spit out some content in this format:

[get the last 4 items from the newsitem table and use the template below]

<div class="newsitem ">
<span class="date">[get the date and put it here]</span>
<h3>[get the date]</h3>
<p>[get the first 40 words]</p>
<p class="moreLink "><a>View More</a></p>
</div>

When I need something like this, are there any server controls I should look at, or should I forget that and just go back to using inline ASP if/then
loops with a lot of response.write' s to generate the wrapping HTML?

Actually, to simplify the question:

When should I use server controls vs. hand-rolled ASP templates?

-Darrel

Nov 18 '05 #6

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

Similar topics

2
2760
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx. The problem is the article is in VisualBasic. I already get the collection to be recognized as a Data Source by the IDE. It populated the DataGrid correctly from the fields on the items object of the collection, but I can't get the DataGrid to...
1
9499
by: xrow | last post by:
Hello I have a simple webservice / c# application that receives data from server and prints the data in the asp:datagrid control I have problem when sorting data in datagrid I have created SortCommand event in my .aspx file for my datagrid DataGrid2 but I am not able to access my datarecord nor dataset from my SortCommand event. I recieve also an error when running with created event if don't change event method declaration to public void...
5
9178
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within a datagrid do >> not << constitute a set of 'selected' records. Apparently one and only one row may be 'selected' in a datagrid. By selected row I mean the row
1
1274
by: Muhammad Usman | last post by:
Respected Assistant I have table in a database named "student" having fields like name of student,Roll No and Status.The status is one of them absent,present or leave.The name and rollno field is already entered but the status is entered from datagrid in such a way that name and rollno is feteched from database and display on datagrid and the status is insert from the dropdown list in the datagrid.
2
1444
by: Steve Chatham | last post by:
I have a datagrid that I want to put sku information into. I can load the select info there, such as: Item# Description Weight etc. However, in the right hand column, or maybe to the right of the datagrid, I'd like to have a hyperlink displayed that would give me more specific information than what I have space to show in the datagrid. An alternative may be to have the user to click on the item number to display this info.
1
231
by: Henk | last post by:
How can I put a certain value of my datagrid into a variable? For example if I have a datagrid with numbers, and I want to put the first value of the first column into an integer :roll: :roll: :roll: Posted Via Usenet.com Premium Usenet Newsgroup Services ---------------------------------------------------------- ** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
15
3129
by: glenn | last post by:
Hi folks, I have a DropDownList in a DataGrid that is populated from records in a database. I want to add a value that might be a string such as "Select a Company" for the first item since an OnSelectedIndex event is not fired if you select the first item. Does anyone know of an easy way to do this?
2
1331
by: Alex Maghen | last post by:
I'd like to set up the DataGrid so that as users rollover a row, that row is highlighted a different color and then goes back on roll-out. Any samples for how to set that up?
0
2911
by: cindy | last post by:
I have a dynamic datagrid. I have custom classes for the controls public class CreateEditItemTemplateDDL : ITemplate { DataTable dtBind; string strddlName; string strSelectedID; string strDataValueField; string strDataTextField; public CreateEditItemTemplateDDL(string DDLName,string DataValueField,string
2
1471
by: NHEXTECH | last post by:
HI I am using asp.net 1.1. My requirement is if i click the data grid cell (like roll no) i want to show the corresponding details about that roll number(like mark ,name)in text box.In data grid click event i want to write that coding plz any one help me.
0
9531
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...
0
9345
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9905
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
9775
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8780
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...
0
5229
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
5373
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3881
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
3
3456
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.