Adding ImageButton to a datagrid header

E

Eric

Ok,
o I have a datagrid with sorting and paging. I would like to add a
small ImageButton right under the header text that I currently use for
sorting. I'm using somehting like this now but it replaces the actual
header text that I need to stay for my sorting capabilities. The image
button needs to fire a seperate event handler that is unrelated to the
sort funtionality.

Dim myLink As New ImageButton
myLink.Text = "Two"
myLink.Attributes.Add("runat", "server")
myLink.Attributes.Add("id", "btnAddNew")
'myLink.Attributes.Add("CommandName", "btnAddNew")
'myLink.Attributes.Add("CommandArgument", "btnAddNew")
e.Item.Cells(2).Controls.Add(myLink)

So, anybody know how I can add a imagebutton to run parallel with my
sorting header text?

Thanks

Eric
 
T

Teemu Keiski

Hi,

couldn't you just use TemplateColumn, so you could put these both into
HeaderTemplate?
 
E

Eric

I tried that. When I did this clicking the added image button sorted
the column rather than firing the handler for the button. Both the
header text and the button were sorting the colum when clicked. I want
the header text to sort the colum and the image button to fire a
seperate event.

Weird huh?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,816
Latest member
SapanaCarpetStudio

Latest Threads

Top