GridButtonColumn does not show changes from CodeBehind on first load

4 posts, 0 answers
  1. rugydp
    rugydp avatar
    15 posts
    Member since:
    Jul 2014

    Posted 23 Sep Link to this post

    Hello

    I have a complex grid with a GridButtonColumn where I want to set some parameters in codebehind. I'm using RadGrid1_PreRender for this.

    Strangely, it only works after I used the pager to change page and not on first load... 

    What am I missing here? I also Page_Load, Page_PreRender, OnColumnCreated, still it just never works on first load and it's driving me insane :/

    Thanks!!

    protected void GridMaster_PreRender(object sender, EventArgs e)
            {         
                    foreach (GridColumn col in GridMaster.MasterTableView.Columns)
                    {
                        if (col.UniqueName == "DeleteEntryCommand")
                        {
                            var deleteColum = col as GridButtonColumn;
                            // deleteColum.ConfirmText = RessourceHelper.GetRessource(name: "KontraktLoeschenBestaetigen", kurzText: false, textIfEmpty: "Soll der Kontrakt wirklich gelöscht werden?", languageId: null);
                            deleteColum.ConfirmTitle = RessourceHelper.GetRessource(name: "KontraktLoeschenBestaetigenTitel", kurzText: false, textIfEmpty: "Kontrakt löschen", languageId: null);
                            deleteColum.ConfirmTextFormatString = RessourceHelper.GetRessource(name: "KontraktLoeschenBestaetigen", kurzText: false, textIfEmpty: "Soll der Kontrakt {0} wirklich gelöscht werden?", languageId: null);
                            deleteColum.ConfirmTextFields = new string[] { "Referenz" };
                        }
                    }
            }

     

    <telerik:GridButtonColumn
     UniqueName="DeleteEntryCommand"
     CommandName="Delete"
     ConfirmDialogType="RadWindow"
     ConfirmDialogWidth="300"
     ConfirmDialogHeight="150"
     Text=""
     ItemStyle-HorizontalAlign="Center"
     ItemStyle-CssClass="radGridDeleteColumn"
     ButtonCssClass="fa fa-trash-o fa-1x radGridDeleteButton">
     <HeaderStyle Width="40" />
    </telerik:GridButtonColumn>

  2. Viktor Tachev
    Admin
    Viktor Tachev avatar
    1488 posts

    Posted 28 Sep Link to this post

    Hello,

    I tested the behavior and it is working as expected on my end when the GridButtonColumn settings are changed in the Page_Load event. I am attaching a sample project I used for testing. Give it a try and see how it works for you.

    Regards,
    Viktor Tachev
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. rugydp
    rugydp avatar
    15 posts
    Member since:
    Jul 2014

    Posted 13 Oct in reply to Viktor Tachev Link to this post

    Hello Viktor

    Thank you for your answer. But I was assigned to another project for the last weeks and couldn't look in to the issue. Now the link you provided is dead.

    Is it possible to provide it again? (Sorry about that...)

    I looked into issue again, now on another project with GridButtonColumn but this time in DetailTables. Same effect: button values change after first postback, but not on first page load... There must be some thing I to fundamentally wrong....

  5. Eyup
    Admin
    Eyup avatar
    3015 posts

    Posted 18 Oct Link to this post

    Hello,

    We were experiencing a technical issue with these archive files, however, I'm pleased to say that our responsive technical experts have already fixed the problem.

    Please excuse us for the inconvenience this might have caused you.


    Regards,
    Eyup
    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
Back to Top