Excluding Button image button from ajax post back

2 posts, 0 answers
  1. EmpowerIT
    EmpowerIT avatar
    117 posts
    Member since:
    Jun 2007

    Posted 28 Oct 2010 Link to this post

    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
  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 29 Oct 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top