E
Eric
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
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