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

How do I get back to ImageButton properties within the ItemCommand event?

1 Answer 19 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Henry
Top achievements
Rank 2
Henry asked on 16 Apr 2014, 10:01 AM
Hi,

How do I get back to ImageButton properties within the ItemCommand event? I need to change the ImageURL once I have done my other database calls.

Regards,

Henry Fourie

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 16 Apr 2014, 11:30 AM
Hello,

protected void grid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if(e.CommandName == "YourCommandName")
    {
        GridDataItem item = e.Item as GridDataItem;
        (item["Your-imagecolumn-uniqueName"].Controls[0] as ImageButton).ImageURL = "Your new image URL comes here";
    }  
}

After assigning the imageURL if you rebind your Grid then it set the old image URL.
If you set the ImageURL based on your Data then it will creates any issue after rebinding Radgrid.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Henry
Top achievements
Rank 2
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or