本文介绍了如何在javascript中获取radgrid文本框值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我希望使用javascript计算总列数。 < telerik:RadGrid ID = RadGrid1 runat = server PagerStyle-AlwaysVisible = true GridLines = 垂直 > < MasterTableView AutoGenerateColumns = False 名称 = 主 ShowHeader = true TableLayout = 已修复 > < 列 > < telerik:GridTemplateColumn ItemStyle-Width = 5% SortExpression = txt1 DataField = txt1 HeaderText = txt1 UniqueName = txt1 > < ItemTemplate > < telerik:RadNumericTextBox ID = txt1 高度 = 25px > < / telerik:RadNumericTextBox > < / ItemTemplate > < / telerik:GridTemplateColumn > < telerik:GridTemplateColumn ItemStyle-Width = 5% SortExpression = txt2 DataField = txt2 HeaderText = txt2 UniqueName = txt2 > < ItemTemplate > < telerik:RadNumericTextBox ID = txt2 > < / telerik:RadNumericTextBox > < / ItemTemplate > < / telerik:GridTemplateColumn > < telerik:GridTemplateColumn ItemStyle-Width = 5% SortExpression = 总计 DataField = 总计 HeaderText = 总计 UniqueName = 总计 > < ItemTemplate > < telerik:RadNumericTextBox ID = txtTotal 高度 = 25px runat = server CssClass = form-control 字体大小 = 更小 > < / telerik :RadNumericTextBox > < / ItemTemplate > < / telerik:GridTemplateColumn > < /列 > < / MasterTableView > < / telerik:RadGrid > 这里的javascript代码 < script type = text / javascript> function 添加(e){ var txt1 = e .find(' #txt1')。val(); var txt2 = e.find(' #TXT2' )VAL(); var 金额= parseFloat (txt1)* parseFloat (TXT2); e.find(' #txtTotal')。val(Amount.toFixed( 6 )); } < / script> 请帮助 我是什么尝试过: 我试图添加gridview计算解决方案 你好请试试这个 < script type =text / javascript> 函数添加(e){ var grid = find(< %= RadGrid1.ClientID%>); var MasterTable = grid.get_masterTableView(); var row = MasterTable.get_dataItems()[index]; var txt1 = row.findElement(txt1)。innerHTML; var txt2 = row.findElement(txt2) .innerHTML;< / pre> } < / script> I want to get total column calculation using javascript.<telerik:RadGrid ID="RadGrid1" runat="server" PagerStyle-AlwaysVisible="true" GridLines="Vertical"> <MasterTableView AutoGenerateColumns="False" Name="Master" ShowHeader="true" TableLayout="Fixed"> <Columns> <telerik:GridTemplateColumn ItemStyle-Width="5%" SortExpression="txt1" DataField="txt1" HeaderText="txt1" UniqueName="txt1"> <ItemTemplate> <telerik:RadNumericTextBox ID="txt1" Height="25px" ></telerik:RadNumericTextBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn ItemStyle-Width="5%" SortExpression="txt2" DataField="txt2" HeaderText="txt2" UniqueName="txt2"> <ItemTemplate> <telerik:RadNumericTextBox ID="txt2" ></telerik:RadNumericTextBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn ItemStyle-Width="5%" SortExpression="Total" DataField="Total" HeaderText="Total" UniqueName="Total"> <ItemTemplate> <telerik:RadNumericTextBox ID="txtTotal" Height="25px" runat="server" CssClass="form-control" Font-Size="Smaller" ></telerik:RadNumericTextBox> </ItemTemplate> </telerik:GridTemplateColumn> </Columns> </MasterTableView> </telerik:RadGrid>here javascript code<script type="text/javascript"> function Add(e) { var txt1 = e.find('#txt1').val(); var txt2 = e.find('#txt2').val(); var Amount = parseFloat(txt1) * parseFloat(txt2); e.find('#txtTotal').val(Amount.toFixed(6)); } </script>Please helpWhat I have tried:I tried to add gridview calculation 解决方案 hi pls try this<script type="text/javascript"> function Add(e) {var grid =find("<%=RadGrid1.ClientID %>"); var MasterTable = grid.get_masterTableView(); var row = MasterTable.get_dataItems()[index]; var txt1 = row.findElement("txt1").innerHTML;var txt2 = row.findElement("txt2").innerHTML;</pre>} </script> 这篇关于如何在javascript中获取radgrid文本框值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-13 13:41