CommandItemTemplate

7 posts, 0 answers
  1. Michael
    Michael avatar
    12 posts
    Member since:
    Aug 2010

    Posted 08 Dec 2010 Link to this post

    Is there a way to change the visiblity of buttons within the CommandItemTemplate tag?  If so what does the code look like to access this property?

    Please disregard this thread.  I figured it out. 



  2. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 08 Dec 2010 Link to this post

    Hi Michael,

    There are cases in which you may want to access the controls inside your CommandItemTemplate from the code-behind and dynamically change their preferences (in par with some particular restrictions/certain conditions). In the following help topic are the steps you can perform to reference controls inside the CommandItemTemplate programmatically:
    http://www.telerik.com/help/aspnet-ajax/grdcommanditemtemplate.html

    I hope this helps.

    Best wishes,
    Pavlina
    the Telerik team
    Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 26 Jul 2011 Link to this post

    I need to do this, but unfortunately the link no longer works. Can you please direct me on how to update controls in the CommandItemTemplate?

    Thanks,
    Adam
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Jul 2011 Link to this post

    Hello Adam,

    Try the following code snippet to hide a LinkButton in CommandItemTemplate.
    protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridCommandItem)
          {
                GridCommandItem commandItem = e.Item as GridCommandItem;
                LinkButton button = commandItem.FindControl("LinkButton1")as LinkButton;
                button.Visible=false;
          }
    }
    For further information you can check the following documentation.
    Command Item Template.

    Thanks,
    Shinu.
  6. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 27 Jul 2011 Link to this post

    Okay, I can update the control and get it to look the way I want in the grid, but it doesn't export when I call the ExportToPDF function in the code behind. I get all the row information, but nothing in the CommandItemTemplate. Here are my ExportSettings.
    <ExportSettings OpenInNewWindow="true" FileName="Schedule" HideStructureColumns="true" ExportOnlyData="false">
                        <Pdf PageHeight="8.5in" PageWidth="11in" PageBottomMargin=".5in" PageTopMargin=".5in" PageLeftMargin=".5in" PageRightMargin=".5in" DefaultFontFamily="Arial" />
                    </ExportSettings>

  7. Adam
    Adam avatar
    177 posts
    Member since:
    Oct 2012

    Posted 28 Jul 2011 Link to this post

    I think it was because I had a table in the CommandItemTemplate and didn't use <colgroup> for the columns. If I understand correctly, it won't export HTML perfectly.
  8. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 29 Jul 2011 Link to this post

    Hello Adam,

    There are a few rules that should be followed when exporting HTML tables to PDF. For more information about them please refer to the Exporting HTML tables section in the help article below:
    http://www.telerik.com/help/aspnet-ajax/grid-pdf-export.html

    All the best,
    Pavlina
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Back to Top
UI for ASP.NET Ajax is Ready for VS 2017