473,498 Members | 2,058 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is two datagrid headers possible? One for sorting, one to add seperate link button.

Hello,
I have a datagrid with sorting enabled. When clickong on the colum
names in the header the datagrid is sorted no problem. Unfortunatly, I
have a graph that needs to be generated for each colum as well. I'd
like to have an additonal header at the top of the datagrid that has
an imagebutton for each colum that would generate the graph.

I've successfully created the second header and programatically added
the imagebutton to the second header. The only proble is that when the
"generate graph" image buttons are clicked, they perfrom the sort
rather than fire my drawGraph event handler. Anybody see what's wrong
with my code? I've been trying to get this right for two days.

Thanks

Eric

'#################################################

Private Sub MyDatagrid_PreRender(ByVal sender As Object, ByVal e
As System.EventArgs) Handles MyDatagrid.PreRender

Dim cmdOne As New ImageButton
cmdOne.ImageUrl = "graph.gif"
cmdOne.Attributes.Add("runat", "server")
cmdOne.Attributes.Add("id", "ImageButton1")
cmdOne.Attributes.Add("OnCommand", "ImageButton1_Click")
cmdOne.Attributes.Add("CommandName", "Click")

Dim dgitem As New DataGridItem(0, 0, ListItemType.Header)

Dim mycell As New TableCell
mycell.Text = ""
mycell.Controls.Add(cmdOne)
dgitem.Cells.Add(mycell)

Dim mycell1 As New TableCell
mycell1.Text = "Two"
dgitem.Cells.Add(mycell1)

Dim mycell2 As New TableCell
mycell2.Text = "Three"
dgitem.Cells.Add(mycell2)

MyDatagrid.Controls(0).Controls.AddAt(0, dgitem)

End Sub

Sub ImageButton1_Click(ByVal sender As Object, ByVal e As
CommandEventArgs)

'this is where the graph is rendered.

End Sub
Nov 18 '05 #1
0 1230

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

Similar topics

0
5342
by: Rudolph Araujo | last post by:
Hi, I needed to build a data grid in which the first column has hyperlinks rather than simple text. I found the following code on this newsgroup and it works fine except for one problem. When I...
1
5279
by: Craig Banks | last post by:
If a row of data in a dataset has a lot of columns the row displaying the data in a datagrid will run way off the screen. What I'd like to do is display a row of data over several datagrid rows so...
11
2117
by: rkbnair | last post by:
I have created a datagrid in my aspx with the 'AllowSorting' property to true. When clicking on the column header, the page refreshes. However the sorting is not done. Am I missing anything? I...
2
1292
by: Lars Netzel | last post by:
I have a Datagrid using the Edit/Update mode to alter data in the datasource. I needed to have a bit more flexible interface in the editmode with a design that couldn't work in the columns. So I...
3
1019
by: Sun | last post by:
Hi I had a sortable datagrid and it worked fine when I clicked the headers. Then I introduced 2 textboxes and a button, so I can pull data based on user input. The data came out fine but the...
4
2705
by: skOOb33 | last post by:
I successfully autosized the columns and rows on my Datagrid, and am now facing another issue. Having the sorting ability by clicking the column headers is key, but when I do that, it resizes all...
0
1092
by: Mike Gorgone | last post by:
Hi All, I'm currently trying to show a datagrid with a parent and child table realtionship. I've got the expansion icon (+) in the row headers and when I click on it I see the link to the child...
3
1448
by: Gidi | last post by:
Hi, I've a dataGrid, and When I click with the mouse on one of it's header the DataGrid_Click event is called. I don't have problem with the event, but strange things happen to the dataGrid...
3
7366
by: rn5a | last post by:
A DataGrid has the following TemplateColumn: <asp:DataGrid ID="dgCart"...OnSortCommand="SortGrid" AllowSorting="true"....> <Column> <asp:TemplateColumn HeaderImageUrl="Images\Up.gif"...
0
7121
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,...
0
7162
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,...
0
7197
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...
1
6881
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...
0
7375
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...
0
5456
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,...
1
4899
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...
0
3088
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...
1
650
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.