473,806 Members | 2,346 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 2943
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
11238
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 file to a path, such as F:/myfiledate.txt that holds the text in txtOutput, then the trigger...
7
9678
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 for a project.
3
5395
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 without specialized software on the client, since it will be universally available to webusers. We...
6
2488
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 create a schedule we can use each day, for example: Monday, June 1, 2004 Company A, unit e Alice...
8
2278
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 loss on how to create the table in the page populated by the data. Previously, I would have just...
2
5062
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 NAME.
0
1538
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 list whether it is a relation, or used in a query, or a LookUp-table used in a table design...
4
12454
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
2741
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 as 'button_left.gif', 'button_middle.gif' and 'button_right.gif') Then create a borderless table...
0
9597
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,...
0
10618
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10366
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10371
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
10110
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...
1
7649
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6877
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4329
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
2
3850
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.