CommandItemTemplate in child DetailTables

3 posts, 0 answers
  1. Torben
    Torben avatar
    7 posts
    Member since:
    Jun 2008

    Posted 19 Nov 2009 Link to this post

    I have a gridview with 3 levels and wants to use CommandItemTemplate in all 3.

    I am using the command items depending of the mode the user is entering data (insert/update/delete)

    F.eks the "Insert" button
    asp:LinkButton ID="btninsert" runat="server" CommandName="PerformInsert" Visible='<%# RadGrid1.MasterTableView.IsItemInserted%>'>



    <img style="border:0px" alt="" src="<%= this.TemplateSourceDirectory %>/Images/Insert.gif" />Insert Message







    and the delete button



    <asp:LinkButton ID="LinkButton1" runat="server" Visible='<%#RadGrid1.EditIndexes.Count == 0 && !RadGrid1.MasterTableView.IsItemInserted%>'



    OnClientClick="javascript:return confirm('Delete this Message?')" CommandName="DeleteSelected"><img style="border:0px" alt=""



    src="<%= this.TemplateSourceDirectory %>/Images/Delete.gif" /> Delete Message




    The problem is the visible code asking if MasterTableView is in insert mode. I need the the possibility to ask if the child is in insert mode.

    any suggestion ?

    thx Torben

  2. Sebastian
    Sebastian avatar
    9934 posts

    Posted 24 Nov 2009 Link to this post

    Hi Torben,

    Here is the syntax that should work for each level of the grid hierarchy:

    <asp:LinkButton ID="btninsert" runat="server" CommandName="PerformInsert" Visible='<%# (Container as GridCommandItem).OwnerTableView.IsItemInserted%>'>

    asp:LinkButton ID="btninsert" runat="server" CommandName="PerformInsert" Visible='<%# CType(Container, GridCommandItem).OwnerTableView.IsItemInserted%>

    Best regards,
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. Talha
    Talha avatar
    55 posts
    Member since:
    May 2007
Back to Top