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

CommandItemTemplate in child DetailTables

2 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Torben
Top achievements
Rank 1
Torben asked on 19 Nov 2009, 08:28 AM

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

 

 

</asp:LinkButton>

 

 

 

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
</asp:LinkButton>

 

 

 


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 Answers, 1 is accepted

Sort by
0
Sebastian
Telerik team
answered on 24 Nov 2009, 04:34 PM
Hi Torben,

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

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

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

Best regards,
Sebastian
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.
0
Talha
Top achievements
Rank 2
answered on 24 Nov 2009, 04:50 PM
Tags
Grid
Asked by
Torben
Top achievements
Rank 1
Answers by
Sebastian
Telerik team
Talha
Top achievements
Rank 2
Share this question
or