This is a migrated thread and some comments may be shown as answers.

[Solved] ImageButton in header of the edit form popup?

1 Answer 80 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Samir Shah
Top achievements
Rank 1
Samir Shah asked on 23 Feb 2010, 04:40 PM
Hello-

 I am using a user control as the edit form popup for one of my grids. I was able to add an image in the header by putting that <img> into the captionformatstring, but is there any way to put an asp imagebutton in there, so i can take actions? Or any other workarounds?

Thanks

1 Answer, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 24 Feb 2010, 06:43 AM
Hello Samir,

I tried following code snippet in order to add ImageBoutton to the header of EditForm from code behind.

C#:
 
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e) 
    { 
        if (e.Item is GridEditFormItem && e.Item.IsInEditMode) 
        { 
            GridEditFormItem editItem = (GridEditFormItem)e.Item; 
 
            ImageButton imgButton = new ImageButton(); 
            imgButton.ImageUrl = "~/Images/image1.gif"
            imgButton.ID = "HeaderImage"
            imgButton.Click += new ImageClickEventHandler(imgButton_Click); 
 
            editItem.Controls[1].Controls[0].Controls[0].Controls[0].Controls.Add(imgButton);     
        } 
    } 

Thanks,
Shinu.
Tags
Grid
Asked by
Samir Shah
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or