By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,193 Members | 1,691 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,193 IT Pros & Developers. It's quick & easy.

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

P: n/a
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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.