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

Excluding Button image button from ajax post back

1 Answer 83 Views
Grid
This is a migrated thread and some comments may be shown as answers.
EmpowerIT
Top achievements
Rank 2
EmpowerIT asked on 28 Oct 2010, 06:29 AM
Hi,
I've read the previous threads on this topic but I still cannot seem to get it working consistently.
I have a radgrid that contains an Image button column. I am registering the button in this column as a post back control in the ItemCreated event of the grid. When the page first loads and I click on this button it works as expected, by doing a full postback. The problem only occurs if any other ajax update is applied to the grid, such as selecting a different page off the grid. The next time i click on the 'post back' button in the column, it will postback via ajax.

Here is my code:

void SearchResults_ItemCreated(object sender, GridItemEventArgs e)
    {
        if(e.Item is GridDataItem)
        {
            GridDataItem item = e.Item as GridDataItem;
            ImageButton publishedImgButton = item["PublishButton"].Controls[0] as ImageButton;
            if (publishedImgButton != null)
            {
                RadScriptManager.GetCurrent(this.Page).RegisterPostBackControl(publishedImgButton);
            }
        }
    }

This is the column definition in the rad grid:
<telerik:GridButtonColumn ItemStyle-HorizontalAlign="Center" HeaderText="Download PDF file" UniqueName="PublishButton" CommandName="GetPublished" ButtonType="ImageButton" ImageUrl="../../Images/Buttons/Small/document_down.png">
      <ItemStyle HorizontalAlign="Center"></ItemStyle>
</telerik:GridButtonColumn>

Thanks for your help

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 29 Oct 2010, 11:09 AM
Hello,

Please examine the following link and see if it helps to disable AJAX for the image button:
Exclude controls from ajaxifying

All the best,
Pavlina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
EmpowerIT
Top achievements
Rank 2
Answers by
Pavlina
Telerik team
Share this question
or