473,568 Members | 3,101 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I create a completely programmed list/table?

Newbie here. Stupid question follows. Please be kind.

I'm using c#.net 2003 and have a web form that uses a datagrid to
display a list from a table. It's working okay but I want to expand the
features of the data being displayed. I've tried the datagrid and data
repeater but I can't customize it to the level I want. I need to be
able to, depending on the data in the table, turn on/off certain
graphics on each line and would selectively display pictures, if one is
available for a record.

I can't see how to do this (reasonably) within the standard controls.
Is there a way to bind a control to a function? I'm thinking to write
out the HTML code manually from within the function (response.write )
and have it display on the form. I need the control to be able to
grow/expand to accomodate lots of records. Don't want the user to have
to scroll within the control.

Any suggestions or code examples on how to do this? Many thanks in
advance.

Jan 12 '06 #1
4 2935
I'm not positive, but I would figure that you would want to use a
DataGrid control in ASP.NET. I believe that you can set a template for the
items, and for each column. For values you don't want to see, set the value
of the column in your data set to null, and have the template process it
accordingly.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<ma*********@ya hoo.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Newbie here. Stupid question follows. Please be kind.

I'm using c#.net 2003 and have a web form that uses a datagrid to
display a list from a table. It's working okay but I want to expand the
features of the data being displayed. I've tried the datagrid and data
repeater but I can't customize it to the level I want. I need to be
able to, depending on the data in the table, turn on/off certain
graphics on each line and would selectively display pictures, if one is
available for a record.

I can't see how to do this (reasonably) within the standard controls.
Is there a way to bind a control to a function? I'm thinking to write
out the HTML code manually from within the function (response.write )
and have it display on the form. I need the control to be able to
grow/expand to accomodate lots of records. Don't want the user to have
to scroll within the control.

Any suggestions or code examples on how to do this? Many thanks in
advance.

Jan 12 '06 #2
As a follow-up to Nick's response, you will find that you can do all kinds of
custom formatting in the DataGrid's ItemDataBound handler. This fires for
every row in the source as it is databound to the grid, and gives you an
opportunity to gain access to the individual column values in the source as
well as controls in the cells of the grid to do whatever custom formatting
suits your fancy.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"ma*********@ya hoo.com" wrote:
Newbie here. Stupid question follows. Please be kind.

I'm using c#.net 2003 and have a web form that uses a datagrid to
display a list from a table. It's working okay but I want to expand the
features of the data being displayed. I've tried the datagrid and data
repeater but I can't customize it to the level I want. I need to be
able to, depending on the data in the table, turn on/off certain
graphics on each line and would selectively display pictures, if one is
available for a record.

I can't see how to do this (reasonably) within the standard controls.
Is there a way to bind a control to a function? I'm thinking to write
out the HTML code manually from within the function (response.write )
and have it display on the form. I need the control to be able to
grow/expand to accomodate lots of records. Don't want the user to have
to scroll within the control.

Any suggestions or code examples on how to do this? Many thanks in
advance.

Jan 12 '06 #3
This is gonna seem a lot like writing Classic ASP code in C#.

Add a placeholder control to your page, where you want the table.
At the point where you have all the data you need for the table, create
an HtmlTable class.
using System.Web.UI.H tmlControls;
// :
HtmlTable table = new HtmlTable();
This will give you an <TABLE></TABLE> when the html is rendered. So,
naturally, the next step is to create the <TR> & <TD>s:
HtmlTableRow tr = new HtmlTableRow();
HtmlTableCell td = new HtmlTableCell() ;

td.InnerText = "Hello,";
tr.Controls.Add (td);

td = new HtmlTableCell() ;
td.InnerHtml = "<B>World!</B>";
tr.Controls.Add (td);

table.Controls. Add(tr);

At this point, we have
"<table><tr><td >Hello,</td><td><b>World !</b></td></tr></table>"

Repeat the last few steps until the table is built as you like.

You can also add attributes to the controls:
table.Attrbutes["border"] = "1";

Finally, add the table to the placeholder:
placeholder1.Co ntrols.Add(tabl e);

--
Truth,
James Curran
[erstwhile VC++ MVP]

Home: www.noveltheory.com Work: www.njtheater.com
Blog: www.honestillusion.com Day Job: www.partsearch.com
<ma*********@ya hoo.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Newbie here. Stupid question follows. Please be kind.

I'm using c#.net 2003 and have a web form that uses a datagrid to
display a list from a table. It's working okay but I want to expand the
features of the data being displayed. I've tried the datagrid and data
repeater but I can't customize it to the level I want. I need to be
able to, depending on the data in the table, turn on/off certain
graphics on each line and would selectively display pictures, if one is
available for a record.

I can't see how to do this (reasonably) within the standard controls.
Is there a way to bind a control to a function? I'm thinking to write
out the HTML code manually from within the function (response.write )
and have it display on the form. I need the control to be able to
grow/expand to accomodate lots of records. Don't want the user to have
to scroll within the control.

Any suggestions or code examples on how to do this? Many thanks in
advance.

Jan 12 '06 #4
> I'm not positive, but I would figure that you would want to use a
DataGrid control in ASP.NET. I believe that you can set a template for the
items, and for each column. For values you don't want to see, set the value
of the column in your data set to null, and have the template process it
accordingly.


I'd like to use datagrid, but it doesn't appear to be able to go as far
as I need. Let me try to flesh it out a bit more.

We have the following tables:

Customer (names, addresses)
Ratings
BuddyList

For each customer record displayed, we might have related ratings
records or buddylist records. If the person has ratings records, then I
want to display a graphic that links to another form. Same thing for
buddylist. Any idea on how to do this with datagrid? Basically, I need
to be able to do sub-queries within a given column.

I like the info that James also provided but I've yet to wrap my head
around it fully. Any further input is appreciated.

Jan 12 '06 #5

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

Similar topics

9
11208
by: Lauren Quantrell | last post by:
Is there a way to create a text file (such as a Windows Notepad file) by using a trigger on a table? What I want to do is to send a row of information to a table where the table: tblFileData has only one column: txtOutput I want to use the DB front end (MS Access) to send the text string to the SQL backend, then have the SQL Server create a...
7
9668
by: Wolfgang Kreuzer | last post by:
Hello all, I have two tables - Projects and ProjectStruct Table Projects contains master records of the projects, ProjectStruct allows to define a project herarchie and contains the fields PrjStructId, ProjectId, PrjStructName, ..., ParentId PrjStructParent contains a reference to the parent or to itselves if record is top-level-record...
3
5371
by: Richard Fritzler | last post by:
I was given the task of designing a complete web based document prep system. In simplest terms (using a msword explanation) create a database of merge fields, and a library of templates. Allow the webuser to select the template, merge his DB record, and produce a formatted document that can be printed or downloaded. We need to do this...
6
2475
by: skgolden | last post by:
My husband and I own a small temporary labor company and deal with 4 major clients (A,B,C & D), each of which has about 2 dozen units in our tristate area that we deal with (ie, Company A, units a,b,c,d,e etc). We send temps possessing various skills (cashier, cook, hostess, etc) to the individual units as needed. What I'm trying to do is...
8
2234
by: ASP Yaboh | last post by:
I have an ArrayList of data gathered from a database. I want to create a web page from this data by creating a <table>, each cell in each row displays the appropriate data. One of those cells in each row needs a <textarea> control. The background supporting classes are completed, the only task left now is to create the web page. I am at a...
2
5044
by: filbennett | last post by:
Hi Everyone, I'm generally unfamiliar with Access form design, but have programmed Cold Fusion applications for a couple of years. I'd like to build a data entry form in Access that allows the following. First, the data schema: Three tables are involved. The first is a PERSONS table which has two fields, SSNUMBER (primary key), and...
0
1515
by: Helge V. Larsen | last post by:
I have with some luck tried to program some VBA that writes a text file with all dependencies and dependants for all tables and queries (should be extended with forms and reports). I am able to find the top level dependencies/dependants only as well as all levels (by looping). For each dependency/dependant I have with no success tried to...
4
12422
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is this: can Access create the document and place it as an OLE object to the relevant table? Any help is greatly appreciated. Ricky
2
2728
by: Bram2 | last post by:
I'm trying to create a graphical button with custom images and text on it. My approach was to split the generic button image into 3 parts: http://img520.imageshack.us/img520/8263/buttonleftdg8.gif http://img520.imageshack.us/img520/4167/buttonmiddlecz4.gif http://img520.imageshack.us/img520/8982/buttonrightnp6.gif (Note: I stored these locally...
0
7692
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...
0
7601
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...
1
7659
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...
0
7962
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...
0
3651
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...
0
3631
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2099
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
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.