如何使用javascript在radgrid的GroupFooterTemplate中找到控件?

时间:2019-01-07 13:37:20

标签: javascript c# asp.net

<telerik:RadGrid ID="radgridStudentInfo" runat="server" AutoGenerateColumns="false" ShowFooter="True"
                        OnItemDataBound="radgridStudentInfo_ItemDataBound" OnPreRender="radgridStudentInfo_PreRender" OnItemCommand="radgridStudentInfo_ItemCommand"
                        GroupingSettings-RetainGroupFootersVisibility="true" Height="100%" Width="100%" OnNeedDataSource="radgridStudentInfo_NeedDataSource">
                        <ClientSettings>
                            <Scrolling AllowScroll="false" />
                        </ClientSettings>
                        <MasterTableView ShowGroupFooter="true" AllowMultiColumnSorting="true" GroupLoadMode="Client" DataKeyNames="OrganizationID,JobID,CandidateID,AgencyID,MainInvoiceID,OrderType,RefInvoiceId,WeekNo,OrientationAmt,CommissionAmount,TotalPenaltyAmt,InvAdjustedAmount,OTHours,OTRate,OncallHours,OncallRate,ChargeHours,ChargeRate,CallbackHours,CallbackRate,ExtendedDayRate,ExtendedDayHours,ExtendedNightRate,ExtendedNightHours,ExtendedWeekEndRate,ExtendedWeekEndHours,HolidayRate" ShowHeadersWhenNoRecords="true">
                            <GroupFooterTemplate>
                                <itemstyle horizontalalign="Right" />


                                    <table style="width: 100%">
                                        <tr>
                                             <td colspan="1" style="text-align: left">
                                                <asp:Label ID="lblInvoiceTotal" runat="server" Style="font-weight: bold;" ></asp:Label>
                                            </td>
                                            <td colspan="9" style="font-weight: bold; text-align: right">
                                                <asp:Label ID="lblInvoicePaidText" Text="Amount to be Paid:" Style="font-weight: bold;" runat="server"></asp:Label>
                                            </td>
                                            <td colspan="1" style="text-align: right">
                                                <asp:Label ID="lblInvoicePaid" runat="server" Style="font-weight: bold;" Text="Invoice Paid"></asp:Label>
                                            </td>

                                        </tr>
                                    </table>
                            </GroupFooterTemplate>
                            <Columns>
                                <telerik:GridTemplateColumn HeaderStyle-Width="30px" UniqueName="CheckBoxall">
                                    <HeaderTemplate>
                                        <asp:CheckBox ID="radChkSelectAll" runat="server" AutoPostBack="true" OnCheckedChanged="radChkSelectAll_CheckedChanged" />
                                    </HeaderTemplate>
                                    <ItemTemplate>
                                        <asp:CheckBox ID="radChkSelect" AutoPostBack="true" runat="server" OnCheckedChanged="radChkSelect_CheckedChanged" onclick="checkBoxClick(this, event);"/>
                                    </ItemTemplate>
                                </telerik:GridTemplateColumn>


                                <telerik:GridBoundColumn DataField="OrgName" HeaderText="Organization">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="LocationName" HeaderText="Location">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="DeptName" HeaderText="Department">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="JobTitle" HeaderText="Job Title">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Skill" HeaderText="Skill">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="CandidateName" HeaderText="Candidate Name">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="PlaceFeePercentage" HeaderText="Placement Fee %" UniqueName="PlaceFee" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="AnnuSalary" HeaderText="Annual Salary" UniqueName="AnnSalary" DataFormatString="{0:$###,##0.00}" Display="false">
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="BillRate" HeaderText="Bill Rate" DataFormatString="{0:$###,##0.00}" UniqueName="BillRate" HeaderStyle-HorizontalAlign="Right">
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Bonus" HeaderText="Bonus" DataFormatString="{0:$###,##0.00}" UniqueName="Bonus">
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="TotalHours" HeaderText="Total Hours" UniqueName="TotalHours" Display="false">
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn HeaderText="Week No" DataField="WeekNo" HeaderStyle-HorizontalAlign="Right">
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="WeekDates" HeaderText="Week Period">
                                </telerik:GridBoundColumn>
                                <telerik:GridButtonColumn CommandName="View" HeaderText="Week Hours" DataTextField="WeekHours" ButtonType="LinkButton" UniqueName="View" HeaderStyle-HorizontalAlign="Right">
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridButtonColumn>


                                <telerik:GridBoundColumn DataField="SubTotalAmount" HeaderText="Sub-Total Amount" DataFormatString="{0:$###,##0.00}" Display="true" UniqueName="SubTotalAmount">
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="SubTotalAmount" HeaderText="Invoice Amount" DataFormatString="{0:$###,##0.00}" UniqueName="TotalAmount" HeaderStyle-HorizontalAlign="Right">
                                    <ItemStyle HorizontalAlign="Right" />
                                </telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="InvoiceDetailsID" HeaderText="InvoiceDetailsID" UniqueName="InvoiceDetailsID" Display="false">
                                </telerik:GridBoundColumn>
                            </Columns>
                        </MasterTableView>
                        <ClientSettings AllowDragToGroup="false" />
                        <GroupingSettings ShowUnGroupButton="false" />
                    </telerik:RadGrid>

->我需要“ lblInvoiceTotal”控件吗?如何找到“ GroupFooterTemplate”中的控件,以及如何为其分配一些值(整数值)?仅在JavaScript中,客户端?

function checkBoxClick(sender, args) {
        debugger;
        var masterTable = $find("<%=radgridStudentInfo.ClientID%>").get_masterTableView();
            var Amt=0; 
          var count = masterTable.get_dataItems().length;
          var checkbox;
          var totalAmt = 0;
          //var totAmt = 0;
          var SubTotal;
          var strAmount = 0;
          var item;


            for (var i = 0; i < count; i++) {
            item = masterTable.get_dataItems()[i];
            checkbox = item.findElement("radChkSelect");

            SubTotal = masterTable.getElementById(masterTable.getElementById("lblInvoiceTotal").value);


            if (checkbox.checked) {
                Amt = masterTable.getCellByColumnUniqueName(masterTable.get_dataItems()[i], "SubTotalAmount").innerHTML;
                Amt = Amt.replace(",", "")
                strAmount =  parseFloat(Amt.replace("$", ""))
                totalAmt = totalAmt + strAmount;
            }

        }
            InvoiceTotal = totalAmt;

我提供了优势

0 个答案:

没有答案