473,666 Members | 2,075 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can 2 columns of a DataGrid have a single heading OR can I have two controls in 1 column?

This page is currently using a Repeater control to create a table with
6 columns. The first column has 2 ImageButton controls and a common
header.

How can I do this with a DataGrid ? I need either 7 columns in my
DataGrid with a shared column heading for the first two columns OR I
need 6 columns with the first DataGrid column showing two small
ImageButtons side-by-side.

PS: I need to use the DataGrid's ItemDataBound event e.g.
<http://www.codeproject .com/aspnet/ItemCreated.asp- so I really need
to use a DataGrid and the HTML must look near identical afterwards.

Nov 10 '06 #1
2 1374

When you need more control of the output, the repeater (asp:repeater) is a
better choice.

You can easily code up a

<th colspan='2'</th>

in a repeater.

DataGrid = flexible and fast, but little control over the output
Repeater = more time to code up, but more control over the output.

..........


"mark4asp" <ma******@gmail .comwrote in message
news:11******** **************@ f16g2000cwb.goo glegroups.com.. .
This page is currently using a Repeater control to create a table with
6 columns. The first column has 2 ImageButton controls and a common
header.

How can I do this with a DataGrid ? I need either 7 columns in my
DataGrid with a shared column heading for the first two columns OR I
need 6 columns with the first DataGrid column showing two small
ImageButtons side-by-side.

PS: I need to use the DataGrid's ItemDataBound event e.g.
<http://www.codeproject .com/aspnet/ItemCreated.asp- so I really need
to use a DataGrid and the HTML must look near identical afterwards.

Nov 10 '06 #2
On Fri, 10 Nov 2006 10:27:04 -0500, "sloan" <sl***@ipass.ne twrote:
>
When you need more control of the output, the repeater (asp:repeater) is a
better choice.

You can easily code up a

<th colspan='2'</th>

in a repeater.

DataGrid = flexible and fast, but little control over the output
Repeater = more time to code up, but more control over the output.

.........


"mark4asp" <ma******@gmail .comwrote in message
news:11******* *************** @f16g2000cwb.go oglegroups.com. ..
>This page is currently using a Repeater control to create a table with
6 columns. The first column has 2 ImageButton controls and a common
header.

How can I do this with a DataGrid ? I need either 7 columns in my
DataGrid with a shared column heading for the first two columns OR I
need 6 columns with the first DataGrid column showing two small
ImageButtons side-by-side.

PS: I need to use the DataGrid's ItemDataBound event e.g.
<http://www.codeproject .com/aspnet/ItemCreated.asp- so I really need
to use a DataGrid and the HTML must look near identical afterwards.
Thanks,

My real problem is that I need to include a username as a parameter to a
client-side javascript function in an event handler for one of the table
columns. That involves nesting javascript quotes in HTML quotes which
are all conflicting with the quotes needed by the server tag. I want
this as an event, with Joe Doe coming from the dataset:

onclick="return confirm('Are you certain you want to delete: Joe
Doe');"

You'd think something that simple would be easy! The ItemDataBound event
looked like a solution to my problem.

Message-ID: <11************ **********@h48g 2000cwc.googleg roups.com>
Nov 11 '06 #3

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

Similar topics

2
4549
by: Nicole | last post by:
I am creating template columns programmatically. I have read the msdn article on this and I'm so close. Article: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchcreatingwebservercontroltemplatesprogrammatically.asp I have narrowed down the problem comes in when the _DataBinding handler is called and the literal text is being assigned, but I can't figure out beyond that. The main problem is that...
1
1314
by: Jennifer | last post by:
I have a datagrid where I am trying to align some columns to the center. The rest should be aligned to the right. When I try the code below I get an error message saying that the index is out of bounds. When debugging I get the column count of the datagrid to be 1. I find this rather ridiculous only because there are 61 columns that I can physically see. :) Plus, the data table that I am using to bind the datagrid has a count of 61. ...
0
1738
by: Luis Esteban Valencia | last post by:
Once a user clicks "add new row", a new row is created in my Datagrid. The datasource is huge so they have to scroll to the bottom of the page to edit the data in the new row. I have come across two EE solutions which use javascript to focus on the textbox in the "editcommandcolumn" mode. However, these solutions were made for non-autogenerated columns. I NEED autogenerated columns for my project. Is it possible to give focus to a...
1
3437
by: sri_san | last post by:
Hello, I have a datagrid in which the header needs to span over 2 columns. I have tried creating a tableCells and tableRow at runtime and set the columnspan property of a cell to 2. But, the heading does not look good and is not aligned to the datagrid columns. Is there another way to do it? Any help would be great!! Thanks, Sam.
2
6398
by: CSL | last post by:
I am using the DataGrid in a Windows Application, how can I adjust the widths of each column individually.
3
1844
by: david | last post by:
I have posted my question before. It seems that I can not find the solution. The question: I have datasource, say, ds which is bounded to a datagrid, dg. Assume that ds have 5 columns, c0,c1,c2,c3,c4. In some case, say, case 1, I want to display columns c0, c1,c2 in dg and use c3 and c4 in code behind. In case 2, I want to display column c0, c3, and c4, and use c1 and c2 in code behind. The following Possible solution do not work:
1
1125
by: Steve | last post by:
I have a DataGrid connected to a DataSet (read in from an XML file). The documentation that I've read suggests that I attach a DataGridTableStyle to the DataGrid to allow for additional formatting. Each of the three columns are text fields so I created and added DataGridTextBoxColumn to the DataGridTableStyle. I set various properties of the DataGridTextBoxColumn but none of them seem to affect the output. There is some type of...
2
2223
by: Tumurbaatar S. | last post by:
I dynamically add columns to DataGrid as described in MSDN articles "Top Questions about the DataGrid Web Server Control" and "Creating Web Server Control Templates Programmatically". The columns are template based and all they use a same template producer. In the edit mode (ListItemType.EditItem) the template adds textbox and validator controls to a column as: public void InstantiateIn(System.Web.UI.Control container) { TextBox tb =...
1
7121
by: ECD | last post by:
Hello all, I can usually find solutions to my .NET problems by searching these groups, but I'm stumped on this one. I have a datagrid in VB.NET (2.0 framework). I want to disable sorting on the first column in the grid only. I havent found a way to reliably do this yet. I tried putting the following code in the datagrid's mouse down event Dim hti As DataGrid.HitTestInfo
0
8448
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
8871
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
8640
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
6198
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
4198
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
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
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
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1776
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.