Hi,
I have a radgrid and in editform mode I have define a table with rows and columns. For some grouping condition in the radgrid I want to make a row invisible. I try in the itemcommand or itemdatabound using Table mytable=<>.findcontrol("tableID") as Table; and for example myTable..Rows[0].Visible = false; and but I see myTable is alway null....
Grid defintion
<telerik:RadFormDecorator Runat="server"></telerik:RadFormDecorator>
<telerik:RadAjaxLoadingPanel Runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxManager runat="server">
<ajaxsettings>
<telerik:AjaxSetting AjaxControlID="DocWerkVAftekenGrid">
<updatedcontrols>
<telerik:AjaxUpdatedControl ControlID="DocWerkVAftekenGrid" UpdatePanelCssClass="" LoadingPanelID="RadAjaxLoadingPanel1"/>
</updatedcontrols>
</telerik:AjaxSetting>
</ajaxsettings>
</telerik:RadAjaxManager>
<asp:Label ID="WerkVoorraad" runat="server" BackColor="#3399FF" Height="30px" Text="Aftekenen Verrichtingen" Width="100%"></asp:Label>
<telerik:RadGrid ID="DocWerkVAftekenGrid" runat="server" AutoGenerateColumns="False" OnItemDataBound="DocWerkVAftekenGrid_ItemDataBound" OnUpdateCommand="DocWerkVAftekenGrid_UpdateCommand" OnNeedDataSource="DocWerkVAftekenGrid_NeedDataSource" OnItemCommand="DocWerkVAftekenGrid_ItemCommand" >
<exportsettings>
<pdf pagewidth="">
</pdf>
</exportsettings>
<ClientSettings Selecting-AllowRowSelect="true" AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True"></Selecting>
<scrolling allowscroll="True" usestaticheaders="True" />
</ClientSettings>
<mastertableview DataKeyNames="docent_id, patient_id, blok_id, str_vcrowid">
<GroupByExpressions>
<telerik:GridGroupByExpression>
<GroupByFields>
<telerik:GridGroupByField FieldName="verrichting"></telerik:GridGroupByField>
</GroupByFields>
<SelectFields>
<telerik:GridGroupByField FieldName="verrichting" HeaderText="AftekenSoort"></telerik:GridGroupByField>
</SelectFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
<Columns>
<telerik:GridEditCommandColumn UniqueName="EditContactColumn"/>
<telerik:GridHyperLinkColumn AllowSorting="False" DataNavigateUrlFields="patient_id" DataNavigateUrlFormatString="http://localhost/EPDBehandelApp/Behandeling.aspx?PatientID={0}" DataTextField="patient_id" DataTextFormatString="Behandelkaart" FilterControlAltText="Filter behandelkaart column" Text="Behandelkaart" UniqueName="behandelkaart" Target="_blank">
<ItemStyle Font-Bold="True" />
</telerik:GridHyperLinkColumn>
<telerik:GridBoundColumn DataField="blokcode" FilterControlAltText="Filter blokcode column" HeaderText="Blok code" UniqueName="blokcode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="patient" FilterControlAltText="Filter patient column" HeaderText="Patient" UniqueName="patient">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="behandelaar" FilterControlAltText="Filter student column" HeaderText="Student" UniqueName="student">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="doorlooptijd" FilterControlAltText="Filter doorlooptijd column" HeaderText="Duur/dag" UniqueName="doorlooptijd">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="verrichting_naam" FilterControlAltText="Filter verrichting_naam column" HeaderText="Verrichting" UniqueName="verrichting_naam">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="verrichting_code" FilterControlAltText="Filter verrichting_code column" HeaderText="Code" UniqueName="verrichting_code">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn DataTextField="elementcode" FilterControlAltText="Filter elementcode column" HeaderText="Element" UniqueName="elementcode">
</telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="vlakcodes" FilterControlAltText="Filter vlakcodes column" HeaderText="Vlak" UniqueName="vlakcodes">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="docent_id" Display="False" FilterControlAltText="Filter docent_id column" HeaderText="DocentID" UniqueName="docent_id">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="patient_id" Display="False" FilterControlAltText="Filter patient_id column" HeaderText="PatientID" UniqueName="patient_id">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="blok_id" Display="False" FilterControlAltText="Filter blok_id column" HeaderText="BlokID" UniqueName="blok_id">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="str_vcrowid" Display="False" FilterControlAltText="Filter blok_id column" HeaderText="VRowID" UniqueName="str_vcrowid">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<FormTemplate>
<table ID="AftekenTable" cellspacing="20" border="0" rules="none" >
<tr ID="eenheid">
<td>Eenheid</td>
<td><telerik:RadComboBox ID="EenheidComboBox" DataTextField="CODE_OMS" DataValueField="CODE_OMS" runat="server" /></td>
</tr>
<tr ID="score">
<td>Score</td>
<td>
<asp:TextBox ID="ScoreTextBox" runat="server" Text='<%# Bind("score") %>' runat="server"/>
</td>
</tr>
<tr>
<td>Vervanger</td>
<td>
<asp:CheckBox ID="TmpDocDefCheckBox" runat="server" Enabled="True" />
</td>
</tr>
<tr>
<td>Administratief</td>
<td>
<asp:CheckBox ID="AdminCheckBox" runat="server" Enabled="True" />
</td>
</tr>
<tr>
<td>Opmerking</td>
<td>
<asp:TextBox ID="OpmTextBox" runat="server" runat="server"/>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'/>
<td> <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"/></td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</mastertableview>
</telerik:RadGrid>
protected void DocWerkVAftekenGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditFormItem && e.Item.IsInEditMode && !(e.Item is GridEditFormInsertItem))
{
GridEditFormItem editForm = e.Item as GridEditFormItem;
RadComboBox tlist = editForm.FindControl("EenheidComboBox") as RadComboBox;
tlist.Items.Clear();
tlist.DataSource = EPDDatasets.GetCodeList("CMS_CODES", "Eenheden");
tlist.DataBind();
Table AftekenTabl = editForm.FindControl("AftekenTable") as Table;
if (AftekenTabl != null) <--- But it is always null !!!
AftekenTabl.Rows[0].Visible = false;
}
}
protected void DocWerkVAftekenGrid_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
GridEditableItem editedItem = e.Item as GridEditableItem;
Table AftekenTabl = editedItem.FindControl("AftekenTable") as Table;
if (AftekenTabl != null) <-- also null thus not working....
AftekenTabl.Rows[0].Visible = false;
}
}
How can I achieve that the row "eenheid"and "score"is invisible when group column is equal to some condtion?
Thanks in advance,
Henk
I have a radgrid and in editform mode I have define a table with rows and columns. For some grouping condition in the radgrid I want to make a row invisible. I try in the itemcommand or itemdatabound using Table mytable=<>.findcontrol("tableID") as Table; and for example myTable..Rows[0].Visible = false; and but I see myTable is alway null....
Grid defintion
<telerik:RadFormDecorator Runat="server"></telerik:RadFormDecorator>
<telerik:RadAjaxLoadingPanel Runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
<telerik:RadAjaxManager runat="server">
<ajaxsettings>
<telerik:AjaxSetting AjaxControlID="DocWerkVAftekenGrid">
<updatedcontrols>
<telerik:AjaxUpdatedControl ControlID="DocWerkVAftekenGrid" UpdatePanelCssClass="" LoadingPanelID="RadAjaxLoadingPanel1"/>
</updatedcontrols>
</telerik:AjaxSetting>
</ajaxsettings>
</telerik:RadAjaxManager>
<asp:Label ID="WerkVoorraad" runat="server" BackColor="#3399FF" Height="30px" Text="Aftekenen Verrichtingen" Width="100%"></asp:Label>
<telerik:RadGrid ID="DocWerkVAftekenGrid" runat="server" AutoGenerateColumns="False" OnItemDataBound="DocWerkVAftekenGrid_ItemDataBound" OnUpdateCommand="DocWerkVAftekenGrid_UpdateCommand" OnNeedDataSource="DocWerkVAftekenGrid_NeedDataSource" OnItemCommand="DocWerkVAftekenGrid_ItemCommand" >
<exportsettings>
<pdf pagewidth="">
</pdf>
</exportsettings>
<ClientSettings Selecting-AllowRowSelect="true" AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True"></Selecting>
<scrolling allowscroll="True" usestaticheaders="True" />
</ClientSettings>
<mastertableview DataKeyNames="docent_id, patient_id, blok_id, str_vcrowid">
<GroupByExpressions>
<telerik:GridGroupByExpression>
<GroupByFields>
<telerik:GridGroupByField FieldName="verrichting"></telerik:GridGroupByField>
</GroupByFields>
<SelectFields>
<telerik:GridGroupByField FieldName="verrichting" HeaderText="AftekenSoort"></telerik:GridGroupByField>
</SelectFields>
</telerik:GridGroupByExpression>
</GroupByExpressions>
<Columns>
<telerik:GridEditCommandColumn UniqueName="EditContactColumn"/>
<telerik:GridHyperLinkColumn AllowSorting="False" DataNavigateUrlFields="patient_id" DataNavigateUrlFormatString="http://localhost/EPDBehandelApp/Behandeling.aspx?PatientID={0}" DataTextField="patient_id" DataTextFormatString="Behandelkaart" FilterControlAltText="Filter behandelkaart column" Text="Behandelkaart" UniqueName="behandelkaart" Target="_blank">
<ItemStyle Font-Bold="True" />
</telerik:GridHyperLinkColumn>
<telerik:GridBoundColumn DataField="blokcode" FilterControlAltText="Filter blokcode column" HeaderText="Blok code" UniqueName="blokcode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="patient" FilterControlAltText="Filter patient column" HeaderText="Patient" UniqueName="patient">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="behandelaar" FilterControlAltText="Filter student column" HeaderText="Student" UniqueName="student">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="doorlooptijd" FilterControlAltText="Filter doorlooptijd column" HeaderText="Duur/dag" UniqueName="doorlooptijd">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="verrichting_naam" FilterControlAltText="Filter verrichting_naam column" HeaderText="Verrichting" UniqueName="verrichting_naam">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="verrichting_code" FilterControlAltText="Filter verrichting_code column" HeaderText="Code" UniqueName="verrichting_code">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn DataTextField="elementcode" FilterControlAltText="Filter elementcode column" HeaderText="Element" UniqueName="elementcode">
</telerik:GridButtonColumn>
<telerik:GridBoundColumn DataField="vlakcodes" FilterControlAltText="Filter vlakcodes column" HeaderText="Vlak" UniqueName="vlakcodes">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="docent_id" Display="False" FilterControlAltText="Filter docent_id column" HeaderText="DocentID" UniqueName="docent_id">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="patient_id" Display="False" FilterControlAltText="Filter patient_id column" HeaderText="PatientID" UniqueName="patient_id">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="blok_id" Display="False" FilterControlAltText="Filter blok_id column" HeaderText="BlokID" UniqueName="blok_id">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="str_vcrowid" Display="False" FilterControlAltText="Filter blok_id column" HeaderText="VRowID" UniqueName="str_vcrowid">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings EditFormType="Template">
<FormTemplate>
<table ID="AftekenTable" cellspacing="20" border="0" rules="none" >
<tr ID="eenheid">
<td>Eenheid</td>
<td><telerik:RadComboBox ID="EenheidComboBox" DataTextField="CODE_OMS" DataValueField="CODE_OMS" runat="server" /></td>
</tr>
<tr ID="score">
<td>Score</td>
<td>
<asp:TextBox ID="ScoreTextBox" runat="server" Text='<%# Bind("score") %>' runat="server"/>
</td>
</tr>
<tr>
<td>Vervanger</td>
<td>
<asp:CheckBox ID="TmpDocDefCheckBox" runat="server" Enabled="True" />
</td>
</tr>
<tr>
<td>Administratief</td>
<td>
<asp:CheckBox ID="AdminCheckBox" runat="server" Enabled="True" />
</td>
</tr>
<tr>
<td>Opmerking</td>
<td>
<asp:TextBox ID="OpmTextBox" runat="server" runat="server"/>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnUpdate" Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'/>
<td> <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False" CommandName="Cancel"/></td>
</tr>
</table>
</FormTemplate>
</EditFormSettings>
</mastertableview>
</telerik:RadGrid>
protected void DocWerkVAftekenGrid_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridEditFormItem && e.Item.IsInEditMode && !(e.Item is GridEditFormInsertItem))
{
GridEditFormItem editForm = e.Item as GridEditFormItem;
RadComboBox tlist = editForm.FindControl("EenheidComboBox") as RadComboBox;
tlist.Items.Clear();
tlist.DataSource = EPDDatasets.GetCodeList("CMS_CODES", "Eenheden");
tlist.DataBind();
Table AftekenTabl = editForm.FindControl("AftekenTable") as Table;
if (AftekenTabl != null) <--- But it is always null !!!
AftekenTabl.Rows[0].Visible = false;
}
}
protected void DocWerkVAftekenGrid_ItemCommand(object sender, GridCommandEventArgs e)
{
if (e.CommandName == "Edit")
{
GridEditableItem editedItem = e.Item as GridEditableItem;
Table AftekenTabl = editedItem.FindControl("AftekenTable") as Table;
if (AftekenTabl != null) <-- also null thus not working....
AftekenTabl.Rows[0].Visible = false;
}
}
How can I achieve that the row "eenheid"and "score"is invisible when group column is equal to some condtion?
Thanks in advance,
Henk