Hi,
I have a grid and its editformtemplate there is another grid. this inner grid maked inplace edits. I make manual update commands on inner grid to decide if I should update database or not. if I fond a problem and decide not to update database I set e.Canceled = True and want to show a warning label which is named lblneedTofindThisLabel below. Warning label is outside of inner gird, inside of formtemplate of outer grid. how can I find this control from inner grid's update command event ?
in other words:
RadGridCompanies
editformtemplate
label
InnerGrid (inplace edit)
Updateevent
-- must find label here.
and the code is :
I have a grid and its editformtemplate there is another grid. this inner grid maked inplace edits. I make manual update commands on inner grid to decide if I should update database or not. if I fond a problem and decide not to update database I set e.Canceled = True and want to show a warning label which is named lblneedTofindThisLabel below. Warning label is outside of inner gird, inside of formtemplate of outer grid. how can I find this control from inner grid's update command event ?
in other words:
RadGridCompanies
editformtemplate
label
InnerGrid (inplace edit)
Updateevent
-- must find label here.
<telerik:RadGrid ID="RadGridCompanies" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSourceCompanies" GridLines="None" AllowAutomaticDeletes="false" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" AllowPaging="True" AllowSorting="True" CellSpacing="0" Width="900px" Skin="Web20" PageSize="20"> <GroupingSettings CaseSensitive="false" /> <ClientSettings AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true" EnableRowHoverStyle="True"> <Selecting AllowRowSelect="true" /> <Selecting AllowRowSelect="True"></Selecting> </ClientSettings> <MasterTableView DataKeyNames="ID, guidid" DataSourceID="SqlDataSourceCompanies" CommandItemDisplay="Top" EditMode="PopUp"> <CommandItemSettings ExportToPdfText="Export to PDF" ShowRefreshButton="False"></CommandItemSettings> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" ReadOnly="True" SortExpression="ID" UniqueName="ID" Visible="false"> <ColumnValidationSettings> <ModelErrorMessage Text=""></ModelErrorMessage> </ColumnValidationSettings> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="guidid" HeaderText="guidid" ReadOnly="True" SortExpression="guidid" UniqueName="guidid" Visible="false"> <ColumnValidationSettings> <ModelErrorMessage Text=""></ModelErrorMessage> </ColumnValidationSettings> </telerik:GridBoundColumn> .... other columns.. <EditFormSettings EditFormType="Template" PopUpSettings-Width="950px" PopUpSettings-Height="650px"> <EditColumn UniqueName="EditCommandColumn1"> </EditColumn> <FormTemplate> <telerik:RadGrid ID="RadGridMids" runat="server" AllowAutomaticUpdates="false" OnUpdateCommand="RadGridMids_UpdateCommand" DataSourceID="SqlDataSourceMids" GridLines="None" Skin="Web20" AutoGenerateColumns="False" CellSpacing="0" Width="800px"> <ClientSettings EnableRowHoverStyle="True"> </ClientSettings> <MasterTableView DataKeyNames="ID" DataSourceID="SqlDataSourceMids" EditMode="InPlace" CommandItemDisplay="Top"> <Columns> <telerik:GridBoundColumn DataField="ID" DataType="System.Int32" HeaderText="ID" ReadOnly="True" UniqueName="ID" Visible="false"></telerik:GridBoundColumn> <telerik:GridTemplateColumn DataField="Bank" FilterControlAltText="Filter BankName column" HeaderText="Bank" SortExpression="Bank" UniqueName="Bank"> <EditItemTemplate> <asp:TextBox ID="BankTextBox" runat="server" Text='<%# Bind("Bank") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="BankLabel" runat="server" Text='<%# Eval("Bank") %>'></asp:Label> </ItemTemplate> ... other columns... </telerik:GridTemplateColumn> <telerik:GridEditCommandColumn> </telerik:GridEditCommandColumn> </Columns> <EditFormSettings> <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn> </EditFormSettings> </MasterTableView> <FilterMenu EnableTheming="True"> <CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> </FilterMenu> </telerik:RadGrid> <asp:Label ID="lblneedTofindThisLabel" runat="server" Text="label to find" Visible="false" ></asp:Label> </FormTemplate> <PopUpSettings Modal="True" Width="1000px" /> </EditFormSettings> </MasterTableView> <FilterMenu EnableImageSprites="False"> </FilterMenu> </telerik:RadGrid>and the code is :
Protected Sub RadGridMids_UpdateCommand(sender As Object, e As GridCommandEventArgs) Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem) Dim ID_ As String = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("ID").ToString() ' .... some logic.... ' -- WHAT X should be. ? Dim lblneedTofindThisLabel As Label = (TryCast(x.FindControl("lblneedTofindThisLabel"), Label)) lblneedTofindThisLabel.visible=true end sub