Hello,
In my grid I have several columns with items. To edit the items I use the popup editform. Some of the items in the grid I want to hide on the popup editform. Although I searched the forum and tried several solutions the problem is still there.
Here's my .aspx code:
And here's one of the solutions I've tried:
In my grid I have several columns with items. To edit the items I use the popup editform. Some of the items in the grid I want to hide on the popup editform. Although I searched the forum and tried several solutions the problem is still there.
Here's my .aspx code:
<telerik:RadGrid ID="gvTasksDataSteward" runat="server" AutoGenerateColumns="False" | |
DataSourceID="dsTasks" GridLines="None" Skin="Office2007" > | |
<ClientSettings EnablePostBackOnRowClick="true"> | |
<Selecting AllowRowSelect="true" /> | |
</ClientSettings> | |
<MasterTableView DataSourceID="dsTasks" Name="DatastewardTasks" DataKeyNames="TaskId" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" EditMode="PopUp"> | |
<RowIndicatorColumn Visible="False"> | |
<HeaderStyle Width="20px"></HeaderStyle> | |
</RowIndicatorColumn> | |
<ExpandCollapseColumn Visible="False" Resizable="False"> | |
<HeaderStyle Width="20px"></HeaderStyle> | |
</ExpandCollapseColumn> | |
<Columns> | |
<telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandProject" > | |
<HeaderStyle Width="20px" /> | |
</telerik:GridEditCommandColumn> | |
<telerik:GridBoundColumn DataField="TaskId" HeaderText="TaskId" UniqueName="TaskId" Visible="false"></telerik:GridBoundColumn> | |
<telerik:GridBoundColumn DataField="CompanyName" HeaderText="Company" SortExpression="Company" UniqueName="Company"></telerik:GridBoundColumn> | |
<telerik:GridBoundColumn DataField="ProjectName" HeaderText="Project" SortExpression="ProjectName" UniqueName="ProjectName"></telerik:GridBoundColumn> | |
<telerik:GridBoundColumn DataField="TaskDescription" HeaderText="TaskDescription" | |
SortExpression="TaskDescription" UniqueName="TaskDescription"> | |
</telerik:GridBoundColumn> | |
<telerik:GridBoundColumn DataField="Remarks" HeaderText="Remarks" SortExpression="Remarks" | |
UniqueName="Remarks"> | |
</telerik:GridBoundColumn> | |
<telerik:GridBoundColumn DataField="StartDate" DataType="System.DateTime" HeaderText="StartDate" | |
SortExpression="StartDate" UniqueName="StartDate" DataFormatString="{0:d}"> | |
</telerik:GridBoundColumn> | |
<telerik:GridBoundColumn DataField="SoortBewerking" HeaderText="SoortBewerking" SortExpression="SoortBewerking" | |
UniqueName="SoortBewerking"> | |
</telerik:GridBoundColumn> | |
<telerik:GridBoundColumn DataField="RealHours" DataType="System.Decimal" HeaderText="RealHours" | |
SortExpression="RealHours" UniqueName="RealHours" Visible="false"> | |
</telerik:GridBoundColumn> | |
<telerik:GridBoundColumn DataField="StatusId" UniqueName="StatusId" Visible="false"></telerik:GridBoundColumn> | |
<telerik:GridButtonColumn ButtonType="PushButton" UniqueName="Accept" Text="Accept" ImageUrl="~/Images/OK.png" ShowInEditForm="false" CommandName="Accepted"></telerik:GridButtonColumn> | |
<telerik:GridButtonColumn ButtonType="PushButton" UniqueName="NotAccept" Text="Not Accept" ImageUrl="~/Images/OK.png" ShowInEditForm="false" CommandName="NotAccepted"></telerik:GridButtonColumn> | |
<telerik:GridButtonColumn ButtonType="PushButton" UniqueName="Executed" Text="Executed" ImageUrl="~/images/11new.gif" ShowInEditForm="false" CommandName="Executed" ConfirmText="Executed?"></telerik:GridButtonColumn> | |
</Columns> | |
<EditFormSettings CaptionFormatString="Edit: {0}" CaptionDataField="ProjectName"> | |
<PopUpSettings ScrollBars="Auto" ></PopUpSettings> | |
<EditColumn ButtonType="ImageButton" CancelText="Cancel Edit" UpdateText="Update Task" | |
InsertText="Insert User" UniqueName="EditCommandColumn"> | |
</EditColumn> | |
<FormTableButtonRowStyle HorizontalAlign="Right"></FormTableButtonRowStyle> | |
</EditFormSettings> | |
</MasterTableView> | |
</telerik:RadGrid> |
And here's one of the solutions I've tried:
Protected Sub gvTasksDataSteward_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles gvTasksDataSteward.PreRender
For Each item As GridDataItem In gvTasksDataSteward.EditItems |
|
Dim itemToEdit As GridEditableItem = If((item.OwnerTableView.EditMode = GridEditMode.PopUp), DirectCast(item, GridEditableItem), DirectCast(item.EditFormItem, GridEditableItem)) | |
itemToEdit("StatusId").Visible = False | |
Next End sub |