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

Disable all textboxes, ComboBoxes, and buttons

1 Answer 384 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Ashhar
Top achievements
Rank 2
Ashhar asked on 07 Sep 2012, 02:49 PM
I want to disable all textboxes, ComboBoxes, and buttons on this page.
But this page have RadPageView and too many nested controls. This is causing the problem.
I have used this code but it not disabling the fields in pageview :
Private Sub DisableAllFields(ByVal status As Boolean)
        For Each c As Control In UpdatePanel1.Controls
            For Each ctrl As Control In c.Controls
                If TypeOf ctrl Is TextBox Then
                    DirectCast(ctrl, TextBox).Enabled = status
                End If
                If TypeOf ctrl Is RadComboBox Then
                    DirectCast(ctrl, RadComboBox).Enabled = status
                End If
                If TypeOf ctrl Is Button Then
                    DirectCast(ctrl, Button).Enabled = status
                End If
                If TypeOf ctrl Is RadTextBox Then
                    DirectCast(ctrl, RadTextBox).Enabled = status
                End If
                If TypeOf ctrl Is RadNumericTextBox Then
                    DirectCast(ctrl, RadNumericTextBox).Enabled = status
                End If
                If TypeOf ctrl Is RadDatePicker Then
                    DirectCast(ctrl, RadDatePicker).Enabled = status
                End If
            Next
        Next
    End Sub

This is the source code of my page:
<%@ Page Title="" Language="VB" MasterPageFile="~/MasterPage/Main.master" AutoEventWireup="false"
    CodeFile="ERP_SCM_INV_PurchaseOrder_New.aspx.vb" Inherits="SCM_ERP_SCM_INV_PurchaseOrder_New" %>
 
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content2" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript">
        function amountcalculation(txtquantity_cn, txtRate, isCredit) {
 
            var Debit = document.getElementById('ctl00_ContentPlaceHolder1_txtItemQuantity_cs_text');
            var Credit = document.getElementById('ctl00_ContentPlaceHolder1_txtItemRate_cs_text');
            var total = document.getElementById('ctl00_ContentPlaceHolder1_txtItemAmount_os');
            var totVal = Debit.value * Credit.value;
            total.value = totVal;
 
        }
    </script>
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <h1 class="page_heading">
                New Purchase Order</h1>
            <h5 id="alert" runat="server">
            </h5>
            <center>
                <table class="tbl_frm1" width="100%">
                    <tr>
                        <td align="left">
                            <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                                <ProgressTemplate>
                                    <img src="../images/wait.gif" alt="" />
                                </ProgressTemplate>
                            </asp:UpdateProgress>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table class="tbl_frm1" width="100%">
                                <tr>
                                    <td align="right">
                                        Vendor:
                                    </td>
                                    <td align="left" colspan="3">
                                        <telerik:RadComboBox ID="cmbVendor_ct" runat="server" Filter="Contains" AutoPostBack="true"
                                            Width="100%" MaxHeight="200px">
                                        </telerik:RadComboBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" width="15%">
                                        Delivery Location:
                                    </td>
                                    <td align="left" width="35%">
                                        <telerik:RadComboBox ID="cmbDeliveryLocation_ct" runat="server" Width="100%">
                                        </telerik:RadComboBox>
                                    </td>
                                    <td align="right" width="20%">
                                        Invoicing Mode:
                                    </td>
                                    <td align="left" width="30%">
                                        <telerik:RadComboBox ID="cmbInvoicingMode_ct" runat="server" Width="100%">
                                        </telerik:RadComboBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        Delivery Date:
                                    </td>
                                    <td align="left">
                                        <telerik:RadDatePicker ID="cmbDeliveryDate_cr" runat="server" Culture="en-US" Width="100%">
                                            <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                                            </Calendar>
                                            <DateInput DateFormat="d/M/yyyy" DisplayDateFormat="d-MMM-yyyy">
                                            </DateInput>
                                            <DatePopupButton HoverImageUrl="" ImageUrl="" />
                                            <DatePopupButton HoverImageUrl="" ImageUrl="" />
                                        </telerik:RadDatePicker>
                                    </td>
                                    <td align="right">
                                        Order Date:
                                    </td>
                                    <td align="left">
                                        <telerik:RadDatePicker ID="cmbPurchaseOrderDate_cr" runat="server" Culture="en-US"
                                            Width="100%">
                                            <Calendar UseColumnHeadersAsSelectors="False" UseRowHeadersAsSelectors="False" ViewSelectorText="x">
                                            </Calendar>
                                            <DateInput DateFormat="d/M/yyyy" DisplayDateFormat="d-MMM-yyyy">
                                            </DateInput>
                                        </telerik:RadDatePicker>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">
                                        Currency
                                    </td>
                                    <td align="left">
                                        <telerik:RadComboBox ID="cmbCurrency_ct" runat="server" Filter="Contains" AutoPostBack="true"
                                            Width="100%">
                                        </telerik:RadComboBox>
                                    </td>
                                    <td align="right">
                                        Rate:
                                    </td>
                                    <td align="left">
                                        <telerik:RadNumericTextBox ID="txtCurrencyRate_cs" Width="100%" runat="server" CssClass="txt_box_mand">
                                        </telerik:RadNumericTextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" valign="top">
                                        Remarks:
                                    </td>
                                    <td align="left" colspan="3">
                                        <asp:TextBox ID="txtRemarks_os" runat="server" TextMode="MultiLine" Width="100%"
                                            CssClass="textarea"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td align="left">
                            <table class="tbl_frm1" width="100%" border="0" cellspacing="2" cellpadding="0">
                                <tr>
                                    <td colspan="4">
                                        <asp:TextBox runat="server" ID="txtPurchaseOrderID" Visible="false" ReadOnly="True"></asp:TextBox>
                                        <asp:TextBox runat="server" ID="txtProductID" Visible="false" ReadOnly="True"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4" align="left">
                                        <span class="sup_heging">Purchase Order Detail</span>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4">
                                        <telerik:RadTabStrip ID="RadTabStrip1" runat="server" Skin="Sitefinity" OnTabClick="SetControls"
                                            MultiPageID="RadMultiPage1" Width="100%" SelectedIndex="0">
                                            <Tabs>
                                                <telerik:RadTab Text="Add Item" Selected="True">
                                                </telerik:RadTab>
                                                <telerik:RadTab Text="Add Product">
                                                </telerik:RadTab>
                                                <telerik:RadTab Text="Quick List">
                                                </telerik:RadTab>
                                            </Tabs>
                                        </telerik:RadTabStrip>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="4" align="left">
                                        <telerik:RadMultiPage runat="server" ID="RadMultiPage1" SelectedIndex="0"
                                            Width="100%">
                                            <telerik:RadPageView runat="server" runat="server" ID="RadPageView1" Selected="True"
                                                Width="100%">
                                                <table class="tbl_frm1" align="center" border="0" cellpadding="0" cellspacing="0"
                                                    width="100%">
                                                    <tr>
                                                        <td colspan="6">
                                                            <span class="sup_heging">Item Detail</span>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td align="right" width="15%">
                                                            Item:
                                                        </td>
                                                        <td colspan="5" align="left">
                                                            <telerik:RadComboBox ID="cmbItem_ct" runat="server" Filter="Contains" Skin="Vista"
                                                                Width="96%" AutoPostBack="True" MaxHeight="200px">
                                                            </telerik:RadComboBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="6" style="border: 2px dashed #ccc;">
                                                            <table class="tbl_frm1" align="center" width="100%">
                                                                <tr>
                                                                    <td align="right" width="15%">
                                                                        Item Code:
                                                                    </td>
                                                                    <td align="left" colspan="2">
                                                                        <telerik:RadComboBox ID="cmbItemCode_ct" runat="server" AutoPostBack="True" Filter="Contains"
                                                                            Skin="Vista" Width="96%" MaxHeight="200px">
                                                                        </telerik:RadComboBox>
                                                                    </td>
                                                                    <td align="right">
                                                                        Other Name:
                                                                    </td>
                                                                    <td align="left" colspan="2">
                                                                        <asp:TextBox ID="txtOtherName_os" runat="server" ReadOnly="true" CssClass="txt_box"
                                                                            Width="87%"></asp:TextBox>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td align="right">
                                                                        Description:
                                                                    </td>
                                                                    <td colspan="5" align="left">
                                                                        <asp:TextBox ID="txtItemDescription_os" runat="server" ReadOnly="true" CssClass="textarea"
                                                                            Width="98%" TextMode="MultiLine"></asp:TextBox>
                                                                    </td>
                                                                </tr>
                                                                <tr>
                                                                    <td align="right">
                                                                        Category:
                                                                    </td>
                                                                    <td align="left">
                                                                        <telerik:RadComboBox ID="cmbItemCategory_ct" runat="server" Filter="Contains" Skin="Vista"
                                                                            Width="90%" Enabled="false">
                                                                        </telerik:RadComboBox>
                                                                    </td>
                                                                    <td align="right">
                                                                        Part Category:
                                                                    </td>
                                                                    <td align="left">
                                                                        <telerik:RadComboBox ID="cmbItemBrand_ct" runat="server" Filter="Contains" Skin="Vista"
                                                                            Width="90%" Enabled="false">
                                                                        </telerik:RadComboBox>
                                                                    </td>
                                                                    <td align="right">
                                                                        Make:
                                                                    </td>
                                                                    <td align="left">
                                                                        <telerik:RadComboBox ID="cmbItemMake_ct" runat="server" Filter="Contains" Skin="Vista"
                                                                            Width="90%" Enabled="false">
                                                                        </telerik:RadComboBox>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="6">
                                                                 
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="6" style="border: 2px dashed #ccc;">
                                                            <table class="tbl_frm1" align="center" width="100%">
                                                                <tr>
                                                                    <td align="right" width="10%">
                                                                        Unit:
                                                                    </td>
                                                                    <td align="left" width="15%">
                                                                        <telerik:RadComboBox ID="cmbItemUnit_ct" runat="server" Skin="Vista" Width="100%">
                                                                        </telerik:RadComboBox>
                                                                    </td>
                                                                    <td align="right" width="10%">
                                                                        Quantity:
                                                                    </td>
                                                                    <td align="left" width="15%">
                                                                        <telerik:RadNumericTextBox runat="server" ID="txtItemQuantity_cs" Width="95%" MinValue="1"
                                                                            CssClass="txt_box_mand">
                                                                        </telerik:RadNumericTextBox>
                                                                    </td>
                                                                    <td align="right" width="10%">
                                                                        Rate:
                                                                    </td>
                                                                    <td align="left" width="15%">
                                                                        <telerik:RadNumericTextBox ID="txtItemRate_cs" Width="95%" runat="server" MinValue="1"
                                                                            CssClass="txt_box_mand">
                                                                            <NumberFormat AllowRounding="False" DecimalDigits="0" GroupSeparator="" />
                                                                        </telerik:RadNumericTextBox>
                                                                    </td>
                                                                    <td align="right" width="10%">
                                                                        Amount:
                                                                    </td>
                                                                    <td align="left" width="15%">
                                                                        <asp:TextBox ID="txtItemAmount_os" runat="server" CssClass="txt_box_mand" Enabled="False"
                                                                            Width="95%"></asp:TextBox>
                                                                    </td>
                                                                </tr>
                                                            </table>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="3" align="left">
                                                            <h5 id="UpdateAlert" runat="server">
                                                            </h5>
                                                        </td>
                                                        <td colspan="3" align="right">
                                                            <asp:Button runat="server" ID="btnAddItem" CssClass="btn" Text="Add" OnClientClick="return verify_form('form',0)" />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="6" align="right">
                                                            <telerik:RadGrid ID="TgrdItems" runat="server" AutoGenerateColumns="False" AllowSorting="True"
                                                                AllowPaging="True" ShowStatusBar="True" GridLines="None" DataMember="Table1"
                                                                Skin="Sunset" CellSpacing="0" PagerStyle-AlwaysVisible="true">
                                                                <MasterTableView Width="100%" GridLines="None" ShowFooter="True">
                                                                    <CommandItemSettings ExportToPdfText="Export to PDF" />
                                                                    <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">
                                                                    </RowIndicatorColumn>
                                                                    <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">
                                                                    </ExpandCollapseColumn>
                                                                    <Columns>
                                                                        <telerik:GridTemplateColumn HeaderText="Item Code" DataField="Itemcode" SortExpression="Itemcode">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItemCode" runat="server" Text='<%# eval("Itemcode") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Item Name" HeaderStyle-Width="10%" DataField="Item"
                                                                            SortExpression="Item">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItem" runat="server" Text='<%# eval("ItemID") %>' Visible="false"></asp:Label>
                                                                                <asp:Label ID="lblItemName" runat="server" Text='<%# eval("Item") %>' Visible="true"></asp:Label>
                                                                                <asp:Label ID="lblPurchaseOrderDetailID" runat="server" Text='<%# eval("PID") %>'
                                                                                    Visible="false"></asp:Label>
                                                                            </ItemTemplate>
                                                                            <HeaderStyle Width="10%" />
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Other Name" DataField="PartNumber" SortExpression="PartNumber">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItemOtherName" runat="server" Text='<%# eval("PartNumber") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Description" SortExpression="Description">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItemDescripotion" runat="server" Text='<%# eval("Description") %>'
                                                                                    Width="250px"></asp:Label>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Category" Visible="false">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblCategory" runat="server" Text='<%# eval("Category") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Part Category" Visible="false">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblBrand" runat="server" Text='<%# eval("Brand") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Make" Visible="false">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblMake" runat="server" Text='<%# eval("Make") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Product Name" HeaderStyle-Width="10%" Visible="false">
                                                                            <ItemTemplate>
                                                                                <%--<asp:Label ID="lblProductName" runat="server" Text='<%# eval("Product_Name") %>'></asp:Label>--%>
                                                                            </ItemTemplate>
                                                                            <HeaderStyle Width="10%" />
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Quantity" FooterText="Total:" DataField="ItemQuantity"
                                                                            UniqueName="ItemQuantity" Aggregate="Sum" GroupByExpression="ItemQuantity Group By ItemQuantity"
                                                                            SortExpression="ItemQuantity">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtQuantity" runat="server" ReadOnly="true" NumberFormat-GroupSeparator=","
                                                                                    NumberFormat-GroupSizes="3" Text='<%# eval("ItemQuantity") %>' Width="50px">
                                                                                </telerik:RadNumericTextBox>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Rate" SortExpression="Rate">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtRate" runat="server" ReadOnly="true" NumberFormat-GroupSeparator=","
                                                                                    NumberFormat-GroupSizes="3" Text='<%# eval("Itemrate") %>' Width="50px">
                                                                                </telerik:RadNumericTextBox>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Amount" FooterText="Total:" DataField="ItemAmount"
                                                                            UniqueName="ItemAmount" Aggregate="Sum" GroupByExpression="ItemAmount Group By ItemAmount"
                                                                            SortExpression="ItemAmount">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtAmount" runat="server" ReadOnly="true" Text='<%# eval("ItemAmount") %>'
                                                                                    NumberFormat-GroupSeparator="," NumberFormat-GroupSizes="3" Width="70px">
                                                                                </telerik:RadNumericTextBox>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <%-- <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn" HeaderText="Edit">
                                        </telerik:GridEditCommandColumn>--%>
                                                                        <telerik:GridTemplateColumn HeaderText="Edit">
                                                                            <ItemTemplate>
                                                                                <asp:ImageButton ID="lnkEdit" ImageUrl="~/images/Edit.Png" runat="server" CommandName="Edit" />
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Delete">
                                                                            <ItemTemplate>
                                                                                <asp:ImageButton ID="lnkDelete" ImageUrl="~/images/Delete.Png" runat="server" CommandName="Delete"
                                                                                    OnClientClick="return confirm('Are you sure to delete the record?')" />
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                    </Columns>
                                                                    <EditFormSettings EditFormType="Template">
                                                                        <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                                                        </EditColumn>
                                                                        <FormTemplate>
                                                                            <table class="tbl_frm1" cellspacing="2" cellpadding="1" width="100%">
                                                                                <tr>
                                                                                    <td align="Right">
                                                                                        Quantity:
                                                                                    </td>
                                                                                    <td align="left">
                                                                                        <telerik:RadNumericTextBox ID="txtquantity" runat="server" CssClass="txt_box_mand"
                                                                                            Text='<%# eval("Quantity") %>' MinValue="1">
                                                                                        </telerik:RadNumericTextBox>
                                                                                    </td>
                                                                                    <td align="Right">
                                                                                        Rate:
                                                                                    </td>
                                                                                    <td align="left">
                                                                                        <telerik:RadNumericTextBox ID="txtRate" runat="server" CssClass="txt_box_mand" Text='<%# eval("Rate") %>'
                                                                                            MinValue="1">
                                                                                        </telerik:RadNumericTextBox>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td align="right">
                                                                                        Description
                                                                                    </td>
                                                                                    <td align="left">
                                                                                        <telerik:RadTextBox ID="txtDescription" runat="server" CssClass="textarea" Width="90%"
                                                                                            TextMode="MultiLine" Text='<%# eval("ItemDescription") %>'>
                                                                                        </telerik:RadTextBox>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td>
                                                                                    </td>
                                                                                    <td>
                                                                                        <asp:Label ID="lblPurchaseOrderID" runat="server" Text='<%# eval("PurchaseOrderDetailID_PK") %>'
                                                                                            Visible="false"></asp:Label>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td align="right" colspan="2">
                                                                                        <asp:Button ID="btnUpdate" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                                                            runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                                                                        </asp:Button
                                                                                        <asp:Button ID="btnCancel" Text="Cancel" runat="server" CausesValidation="False"
                                                                                            CommandName="Cancel"></asp:Button>
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </FormTemplate>
                                                                    </EditFormSettings>
                                                                    <PagerStyle AlwaysVisible="True" />
                                                                </MasterTableView>
                                                                <PagerStyle AlwaysVisible="True" />
                                                                <FilterMenu EnableImageSprites="False">
                                                                </FilterMenu>
                                                                <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Sunset">
                                                                </HeaderContextMenu>
                                                            </telerik:RadGrid>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </telerik:RadPageView>
                                            <telerik:RadPageView runat="server" ID="RadPageView2" Width="100%">
                                                <table class="tbl_frm1" align="center" border="0" cellpadding="0" cellspacing="0"
                                                    width="100%">
                                                    <tr>
                                                        <td colspan="4">
                                                            <span class="sup_heging">Product</span>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td align="right" width="15%">
                                                            Product:
                                                        </td>
                                                        <td colspan="3" align="left">
                                                            <telerik:RadComboBox ID="cmbProduct_ct" AutoPostBack="True" runat="server" Enabled="false"
                                                                Filter="Contains" Skin="Vista" Width="96%" MaxHeight="200px">
                                                            </telerik:RadComboBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td align="right">
                                                            Quantity:
                                                        </td>
                                                        <td align="left">
                                                            <telerik:RadNumericTextBox runat="server" ID="txtProductQuantity_cs" AutoPostBack="True"
                                                                OnTextChanged="CalculateAmount" Visible="false">
                                                                <NumberFormat DecimalDigits="0" GroupSeparator="" />
                                                            </telerik:RadNumericTextBox>
                                                        </td>
                                                        <td align="right">
                                                            Amount:
                                                        </td>
                                                        <td align="left">
                                                            <telerik:RadNumericTextBox runat="server" ID="txtProductAmount">
                                                            </telerik:RadNumericTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4" align="right">
                                                            <asp:Button runat="server" ID="btnAddProduct" CssClass="btn" Text="Add" OnClientClick="return verify_form('form',0)" />
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td align="left" colspan="4">
                                                            <telerik:RadGrid ID="TgrdProduct" runat="server" AutoGenerateColumns="False" AllowSorting="True"
                                                                AllowPaging="True" ShowStatusBar="True" GridLines="None" DataMember="Table1"
                                                                Skin="Sunset" CellSpacing="0" PagerStyle-AlwaysVisible="true">
                                                                <MasterTableView Width="100%" GridLines="None" ShowFooter="True">
                                                                    <Columns>
                                                                        <telerik:GridTemplateColumn HeaderText="Product" DataField="Product_Name" SortExpression="Product_Name">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblPurchaseOrderID" runat="server" Text='<%# eval("PurchaseOrderID_PK") %>'
                                                                                    Visible="false">
                                                                                </asp:Label><asp:Label ID="lblProduct" runat="server" Text='<%# eval("Product_Name") %>'>
                                                                                </asp:Label><asp:Label ID="lblProductID" runat="server" Text='<%# eval("ProductID") %>'
                                                                                    Visible="false">
                                                                                </asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn DataField="ProductQuantity" HeaderText="Quantity" FooterText="Total:"
                                                                            UniqueName="ProductQuantity" Aggregate="Sum" GroupByExpression="ProductQuantity Group By ProductQuantity"
                                                                            SortExpression="ProductQuantity">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtProductQuantity" runat="server" ReadOnly="true"
                                                                                    NumberFormat-GroupSeparator="," NumberFormat-GroupSizes="3" Text='<%# eval("ProductQuantity") %>'
                                                                                    Width="50px">
                                                                                </telerik:RadNumericTextBox>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn DataField="ProductAmount" HeaderText="Amount" FooterText="Total:"
                                                                            UniqueName="ProductAmount" Aggregate="Sum" GroupByExpression="ProductAmount Group By ProductAmount"
                                                                            SortExpression="ProductAmount">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtProductAmount" Text='<%# eval("ProductAmount") %>'
                                                                                    runat="server" ReadOnly="true" NumberFormat-GroupSeparator="," NumberFormat-GroupSizes="3"
                                                                                    Width="70px">
                                                                                </telerik:RadNumericTextBox></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="View Detail">
                                                                            <ItemTemplate>
                                                                                <asp:LinkButton runat="server" ID="lnkEdit" CommandName="Edit">View Detail</asp:LinkButton></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Delete">
                                                                            <ItemTemplate>
                                                                                <asp:ImageButton ID="lnkDelete" ImageUrl="~/images/Delete.Png" runat="server" CommandName="Delete"
                                                                                    OnClientClick="return confirm('Are you sure to delete the record?')" /></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                    </Columns>
                                                                </MasterTableView>
                                                            </telerik:RadGrid>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4">
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="2" align="left">
                                                            <h5 id="ItemUpdateAlert" runat="server">
                                                            </h5>
                                                        </td>
                                                        <td colspan="2" align="right">
                                                            <asp:LinkButton runat="server" ID="btnCloseDetail" Visible="false">X Close</asp:LinkButton>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4">
                                                            <telerik:RadGrid ID="TgrdProductItem" runat="server" AutoGenerateColumns="False"
                                                                AllowSorting="True" AllowPaging="True" ShowStatusBar="True" GridLines="None"
                                                                DataMember="Table1" Skin="Sunset" CellSpacing="0" PagerStyle-AlwaysVisible="true">
                                                                <MasterTableView Width="100%" GridLines="None" ShowFooter="True">
                                                                    <Columns>
                                                                        <telerik:GridTemplateColumn HeaderText="Item Code" DataField="Itemcode" SortExpression="Itemcode">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItemCode" runat="server" Text='<%# eval("Itemcode") %>'></asp:Label>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Item Name" HeaderStyle-Width="10%" DataField="Item"
                                                                            SortExpression="Item">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItem" runat="server" Text='<%# eval("ItemID") %>' Visible="false">
                                                                                </asp:Label>
                                                                                <asp:Label ID="lblItemName" runat="server" Text='<%# eval("Item") %>' Visible="true">
                                                                                </asp:Label>
                                                                                <asp:Label ID="lblPurchaseOrderDetailID" runat="server" Text='<%# eval("PurchaseOrderDetailID_PK") %>'
                                                                                    Visible="false">
                                                                                </asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Other Name" DataField="PartNumber" SortExpression="PartNumber">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItemOtherName" runat="server" Text='<%# eval("PartNumber") %>'></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Description">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItemDescripotion" runat="server" Text='<%# eval("Description") %>'
                                                                                    Width="250px"></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Category" Visible="false">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblCategory" runat="server" Text='<%# eval("Category") %>'></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Part Category" Visible="false">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblBrand" runat="server" Text='<%# eval("Brand") %>'></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Make" Visible="false">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblMake" runat="server" Text='<%# eval("Make") %>'></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Product Name" HeaderStyle-Width="10%" Visible="false">
                                                                            <ItemTemplate>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn DataField="Quantity" HeaderText="Quantity" FooterText="Total:"
                                                                            UniqueName="Quantity" Aggregate="Sum" GroupByExpression="Quantity Group By Quantity"
                                                                            SortExpression="Quantity">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtProductItemQty" runat="server" ReadOnly="true"
                                                                                    NumberFormat-GroupSeparator="," NumberFormat-GroupSizes="3" Text='<%# eval("Quantity") %>'
                                                                                    Width="50px">
                                                                                </telerik:RadNumericTextBox>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Rate" DataField="Rate" SortExpression="Rate">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtRate" runat="server" ReadOnly="true" NumberFormat-GroupSeparator=","
                                                                                    NumberFormat-GroupSizes="3" Text='<%# eval("Rate") %>' Width="50px">
                                                                                </telerik:RadNumericTextBox>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn DataField="Amount" HeaderText="Amount" FooterText="Total:"
                                                                            UniqueName="Amount" Aggregate="Sum" GroupByExpression="Amount Group By Amount"
                                                                            SortExpression="Amount">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtProductItemAmount" runat="server" ReadOnly="true"
                                                                                    Text='<%# eval("Amount") %>' NumberFormat-GroupSeparator="," NumberFormat-GroupSizes="3"
                                                                                    Width="70px">
                                                                                </telerik:RadNumericTextBox>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn DefaultInsertValue="" HeaderText="Edit " UniqueName="Edit">
                                                                            <ItemTemplate>
                                                                                <asp:ImageButton ID="lnkEdit" ImageUrl="~/images/Edit.Png" runat="server" CommandName="Edit" /></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn DefaultInsertValue="" HeaderText="Delete " UniqueName="Delete">
                                                                            <ItemTemplate>
                                                                                <asp:ImageButton ID="lnkDelete" ImageUrl="~/images/Delete.Png" runat="server" CommandName="Delete"
                                                                                    OnClientClick="return confirm('Are you sure to delete the record?')" /></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                    </Columns>
                                                                    <EditFormSettings EditFormType="Template">
                                                                        <FormTemplate>
                                                                            <table class="tbl_frm1" cellspacing="2" cellpadding="1" width="100%">
                                                                                <tr>
                                                                                    <td align="right">
                                                                                        Quantity:
                                                                                    </td>
                                                                                    <td align="left">
                                                                                        <telerik:RadNumericTextBox runat="server" ID="txtProductItemQty" Text='<%# eval("Quantity") %>'
                                                                                            MinValue="1">
                                                                                        </telerik:RadNumericTextBox><asp:Label ID="lblPurchaseOrderDetailID" runat="server"
                                                                                            Text='<%# eval("PurchaseOrderDetailID_PK") %>' Visible="false"></asp:Label>
                                                                                    </td>
                                                                                    <td align="right">
                                                                                        Rate:
                                                                                    </td>
                                                                                    <td align="left">
                                                                                        <telerik:RadNumericTextBox runat="server" ID="txtRate" Text='<%# eval("Rate") %>'
                                                                                            MinValue="1">
                                                                                        </telerik:RadNumericTextBox>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td align="right">
                                                                                        Description
                                                                                    </td>
                                                                                    <td align="left">
                                                                                        <telerik:RadTextBox ID="txtDescription" runat="server" CssClass="textarea" Width="90%"
                                                                                            TextMode="MultiLine" Text='<%# eval("ItemDescription") %>'>
                                                                                        </telerik:RadTextBox>
                                                                                    </td>
                                                                                </tr>
                                                                                <tr>
                                                                                    <td align="right" colspan="4">
                                                                                        <asp:Button ID="Button1" CssClass="btn" Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "Insert", "Update") %>'
                                                                                            runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update")%>'>
                                                                                        </asp:Button
                                                                                        <asp:Button ID="btnCancel" CssClass="btn" Text="Cancel" runat="server" CausesValidation="False"
                                                                                            CommandName="Cancel"></asp:Button>
                                                                                    </td>
                                                                                </tr>
                                                                            </table>
                                                                        </FormTemplate>
                                                                    </EditFormSettings>
                                                                    <ExpandCollapseColumn ButtonType="ImageButton" Visible="False" UniqueName="ExpandColumn">
                                                                        <HeaderStyle Width="19px"></HeaderStyle>
                                                                    </ExpandCollapseColumn>
                                                                </MasterTableView></telerik:RadGrid>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </telerik:RadPageView>
                                            <telerik:RadPageView runat="server" ID="RadPageView3" Width="100%">
                                                <table class="tbl_frm1" align="center" border="0" cellpadding="0" cellspacing="0"
                                                    width="100%">
                                                    <tr>
                                                        <td colspan="4">
                                                            <span class="sup_heging">Quick List</span>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4">
                                                            <telerik:RadGrid ID="TgrdPurchaseOrderDetail" runat="server" AutoGenerateColumns="False"
                                                                AllowSorting="True" AllowPaging="True" ShowStatusBar="True" GridLines="None"
                                                                DataMember="Table1" Skin="Sunset" CellSpacing="0" PagerStyle-AlwaysVisible="true">
                                                                <MasterTableView Width="100%" GridLines="None" ShowFooter="True">
                                                                    <Columns>
                                                                        <telerik:GridTemplateColumn HeaderText="Item Code" DataField="Itemcode" SortExpression="Itemcode">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItemCode" runat="server" Text='<%# eval("Itemcode") %>'>
                                                                                </asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Item Name" HeaderStyle-Width="10%" DataField="Item"
                                                                            SortExpression="Item">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItem" runat="server" Text='<%# eval("ItemID") %>' Visible="false"></asp:Label><asp:Label
                                                                                    ID="lblItemName" runat="server" Text='<%# eval("Item") %>' Visible="true"></asp:Label><asp:Label
                                                                                        ID="lblPurchaseOrderDetailID" runat="server" Text='<%# eval("PurchaseOrderDetailID_PK") %>'
                                                                                        Visible="false"></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Other Name" DataField="PartNumber" SortExpression="PartNumber">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItemOtherName" runat="server" Text='<%# eval("PartNumber") %>'></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Description">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblItemDescripotion" runat="server" Text='<%# eval("Description") %>'
                                                                                    Width="250px"></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Category" Visible="false">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblCategory" runat="server" Text='<%# eval("Category") %>'></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Part Category" Visible="false">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblBrand" runat="server" Text='<%# eval("Brand") %>'></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Make" Visible="false">
                                                                            <ItemTemplate>
                                                                                <asp:Label ID="lblMake" runat="server" Text='<%# eval("Make") %>'></asp:Label></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Product Name" HeaderStyle-Width="10%" Visible="false">
                                                                            <ItemTemplate>
                                                                            </ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn DataField="itemQuantity" HeaderText="Quantity" FooterText="Total:"
                                                                            UniqueName="Quantity" Aggregate="Sum" GroupByExpression="itemQuantity Group By itemQuantity"
                                                                            SortExpression="itemQuantity">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtQty" runat="server" ReadOnly="true" NumberFormat-GroupSeparator=","
                                                                                    NumberFormat-GroupSizes="3" Text='<%# eval("itemQuantity") %>' Width="50px">
                                                                                </telerik:RadNumericTextBox></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn HeaderText="Rate" DataField="itemRate" SortExpression="itemRate">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtItemRate" runat="server" ReadOnly="true" NumberFormat-GroupSeparator=","
                                                                                    NumberFormat-GroupSizes="3" Text='<%# eval("itemRate") %>' Width="50px">
                                                                                </telerik:RadNumericTextBox></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                        <telerik:GridTemplateColumn DataField="itemAmount" HeaderText="Amount" FooterText="Total:"
                                                                            UniqueName="Amount" Aggregate="Sum" GroupByExpression="itemAmount Group By itemAmount"
                                                                            SortExpression="itemAmount">
                                                                            <ItemTemplate>
                                                                                <telerik:RadNumericTextBox ID="txtItemAmount" runat="server" ReadOnly="true" Text='<%# eval("itemAmount") %>'
                                                                                    NumberFormat-GroupSeparator="," NumberFormat-GroupSizes="3" Width="70px">
                                                                                </telerik:RadNumericTextBox></ItemTemplate>
                                                                        </telerik:GridTemplateColumn>
                                                                    </Columns>
                                                                </MasterTableView></telerik:RadGrid>
                                                        </td>
                                                    </tr>
                                                </table>
                                            </telerik:RadPageView>
                                        </telerik:RadMultiPage>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4" align="center">
                            <asp:Button runat="server" ID="btnSave" Text="Save" CssClass="btn" Width="90px" Visible="false" />
                            <asp:Button runat="server" ID="btnDiscard" Text="Discard" CssClass="btn" Width="90px"
                                Visible="false" />
                        </td>
                    </tr>
                    <tr>
                        <td align="center">
                            <asp:Button runat="server" ID="btnSendforApproval" Width="185px" Text="Save Send For Approval"
                                CssClass="btnS" Visible="false" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="4" align="center">
                            <asp:Button runat="server" ID="btnApprove" Text="Approve" CssClass="btn" Width="90px"
                                Visible="false" />
                            <asp:Button runat="server" ID="btnClose" Text="Close" CssClass="btn" Width="90px"
                                Visible="false" />
                            <asp:Button runat="server" ID="btnReject" Text="Reject" CssClass="btn" Width="90px"
                                Visible="false" />
                        </td>
                    </tr>
                </table>
            </center>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>

1 Answer, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 12 Sep 2012, 12:57 PM
Hi Ashhar,

Could you please try the following implementation and let us know if it works properly at your end:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
       DisableAll(UpdatePanel1.Controls(0), False)
   End Sub
 
 
   Protected Sub DisableAll(collection As Control, status As Boolean)
       For Each ctrl As Control In collection.Controls
           If TypeOf ctrl Is RadTabStrip Then
               Dim TabStrip As RadTabStrip = TryCast(ctrl, RadTabStrip)
               TabStrip.Enabled = status
               DisableAll(TryCast(TabStrip.MultiPage.PageViews(0), Control), status)
           End If
           If TypeOf ctrl Is RadComboBox Then
               TryCast(ctrl, RadComboBox).Enabled = status
           ElseIf TypeOf ctrl Is TextBox Then
               TryCast(ctrl, TextBox).Enabled = status
           ElseIf TypeOf ctrl Is Button Then
               TryCast(ctrl, Button).Enabled = status
           ElseIf TypeOf ctrl Is RadTextBox Then
               TryCast(ctrl, RadTextBox).Enabled = status
           ElseIf TypeOf ctrl Is RadNumericTextBox Then
               TryCast(ctrl, RadNumericTextBox).Enabled = status
           ElseIf TypeOf ctrl Is RadDatePicker Then
               TryCast(ctrl, RadDatePicker).Enabled = status
           End If
       Next
 
   End Sub



All the best,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
General Discussions
Asked by
Ashhar
Top achievements
Rank 2
Answers by
Nencho
Telerik team
Share this question
or