本文介绍了Gridview文本框值未显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我有使用javascript计算的asp.net gridview < pre lang =Javascript> 函数UpdateArea(cname){ var Height = cname.find('#txtHeight')。val(); var length = cname.find('#txtLength')。val(); var Area = cname.find('#txtArea')。val(); if(isNaN(parseFloat(Height))){ Height = 0; } if(isNaN(parseFloat(Length))){ 长度= 0;} var Amount = parseFloat(Length)* parseFloat (高度); cname.find('#txtArea')。val(Amount.toFixed(2));} when我将数据绑定到gridview只显示数据绑定文件。文本框值未显示。请帮助I have asp.net gridview with javascript calculation<pre lang="Javascript"> function UpdateArea(cname) { var Height = cname.find('#txtHeight').val(); var Length = cname.find('#txtLength').val(); var Area = cname.find('#txtArea').val(); if (isNaN(parseFloat(Height))) { Height = 0;} if (isNaN(parseFloat(Length))) { Length = 0;} var Amount = parseFloat(Length) * parseFloat(Height); cname.find('#txtArea').val(Amount.toFixed(2));}when i'm binding data to the gridview only showing databound fileds. textbox values are not showing. please help<asp:GridView ID="gdComponent" runat="server" AutoGenerateColumns="False" Font-Size="12px" CssClass="table table-striped table-bordered table-hover" TabIndex="3" AllowSorting="True" Width="100%" ><AlternatingRowStyle CssClass="alt"></AlternatingRowStyle><Columns><asp:BoundField HeaderText="Component" DataField="ComponentName" SortExpression="ComponentName"><HeaderStyle ForeColor="White" BackColor="#337ab7" Width="10%" HorizontalAlign="Left" /></asp:BoundField><asp:TemplateField HeaderText="Length"><ItemTemplate><asp:TextBox ID="txtLength" runat="server" Text='<%# Bind("Length","{0:0.00}") %>'Width="50px" onKeyup="UpdateArea($(this).parent().parent())" onblur="UpdateArea($(this).parent().parent())"CssClass="contentTransparent" MaxLength="7" ClientIDMode="AutoID" ></asp:TextBox></ItemTemplate><HeaderStyle ForeColor="White" BackColor="#337ab7" Width="5%" HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Right" /></asp:TemplateField><asp:TemplateField HeaderText="Height"><ItemTemplate><asp:TextBox ID="txtHeight" runat="server" Text='<%# Eval("Height","{0:0.00}") %>'Width="50px" CssClass="content-right" MaxLength="12" ClientIDMode="AutoID" onkeypress="return isNumberKey(event)"ReadOnly="true" onKeyup="UpdateArea($(this).parent().parent())" onblur="UpdateArea($(this).parent().parent())"></asp:TextBox></ItemTemplate><HeaderStyle ForeColor="White" BackColor="#337ab7" Width="5%" HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Right" /></asp:TemplateField> <asp:TemplateField HeaderText="Area"><ItemTemplate><asp:TextBox ID="txtArea" runat="server" Text='<%# Bind("Area","{0:0.00}") %>'Width="50px" CssClass="contentTransparent" MaxLength="7" ClientIDMode="Static"></asp:TextBox></ItemTemplate><HeaderStyle ForeColor="White" BackColor="#337ab7" Width="5%" HorizontalAlign="Left" /><ItemStyle HorizontalAlign="Right" /></asp:TemplateField></Columns><PagerStyle CssClass="pgr"></PagerStyle><HeaderStyle CssClass="gridline" BackColor="DarkBlue" /></asp:GridView> 我的尝试: 将数据加载到gridv文本框。但只显示数据绑定文件What I have tried:Load data to gridview textboxes. But only showing databound fileds推荐答案 这篇关于Gridview文本框值未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
09-06 00:45