Detailsview文本框使用javascript在详细信息视图中更改了事件可见字段 [英] Detailsview textbox changed event visible field in details view using javascript
本文介绍了Detailsview文本框使用javascript在详细信息视图中更改了事件可见字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
在详细视图中有模板字段文本框隐藏/显示其他文本框更改
没有回发因为回发值不是得到其他控制权。
我的代码:
Hi all,
In detailview have template field textbox hide/show when other textbox changes
without postback because postback values is not getting for other control.
my code:
<script type="text/javascript" language="javascript">
function showhidetextbox(c,f) {
DetailsView dtlvwActiveList = (DetailsView)Page.Form.FindControl("dtlvwActiveList");
var text = document.getElementById('<%= dtlvwActiveList.FindControl("txtIIterations").ClientID %>')
if (text.value == "2") {
document.getElementById('<%= dtlvwActiveList.FindControl("txtInodayspost").ClientID %>').style.visibility = true;
}
else {
document.getElementById('<%= dtlvwActiveList.FindControl("txtInodayspost").ClientID %>').style.visibility = false;
}
}
但是它给错误对象引用没有设置instacne object.plz帮帮我。
i在谷歌尝试但是我没找到解决方案
和可见设计的其他代码false:
but it give error object references is not set instacne object.plz help me.
i try out in google but i did not find out solution
and other code for visible design false:
<asp:TemplateField HeaderText="Iterations (1x – Pre, 2x – Pre & Post, on-going)">
<ItemTemplate>
<asp:Label ID="lblIterations" runat="server" Text='<%# Bind("Iterations") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEIterations" runat="server" OnTextChanged="txtEIterations_TextChanged" MaxLength="8" Width="6%" Text='<%# Bind("Iterations") %>'></asp:TextBox> x
<%--<asp:RegularExpressionValidator ID="revEIterations" runat="server" ControlToValidate="txtEIterations"
ValidationExpression="[0-9\s]*" ErrorMessage="Iterations should be numeric"></asp:RegularExpressionValidator>--%>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="txtIIterations" onchange="showhidetextbox(this,this.form)" runat="server" MaxLength="8" Width="6%" Text='<%# Bind("Iterations") %>'></asp:TextBox> x
<%-- <asp:RegularExpressionValidator ValidationGroup="InsertGroup" ID="revIIterations" runat="server" ControlToValidate="txtIIterations"
ValidationExpression="[0-9\s]*" ErrorMessage="Iterations should be numeric"></asp:RegularExpressionValidator>--%>
</InsertItemTemplate>
<ItemStyle CssClass="DetailsViewItemStyle" />
</asp:TemplateField>
<pre lang="xml"><asp:TemplateField HeaderText="No.of the days for 2x post" Visible="false">
<ItemTemplate>
<asp:Label ID="lblnodayspost" runat="server" Text='<%#Bind("NoOfDays2xPost") %>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtEnodayspost" runat="server" MaxLength="8" Width="6%" Text='<%# Bind("NoOfDays2xPost") %>'></asp:TextBox>&nbsp;
<asp:RangeValidator ID="YourERangeValidator" runat="server"
ControlToValidate="txtEnodayspost"
ErrorMessage="Please enter a number between 0-99"
Type="Integer"
MinimumValue="0"
MaximumValue="99"></asp:RangeValidator>
<asp:RequiredFieldValidator ID="rfvtxtEnodayspost" runat="server" ControlToValidate="txtEnodayspost"
Text="" ErrorMessage="No of days 2x post is required" Display="Dynamic"></asp:RequiredFieldValidator>
</EditItemTemplate>
<InsertItemTemplate>
<asp:TextBox ID="txtInodayspost" runat="server" MaxLength="8" Width="6%" Text='<%# Bind("NoOfDays2xPost") %>'></asp:TextBox>&nbsp;
<asp:RangeValidator ID="YourIRangeValidator" runat="server"
ControlToValidate="txtInodayspost"
ErrorMessage="Please enter a number between 0-99"
Type="Integer"
MinimumValue="0"
MaximumValue="99" ></asp:RangeValidator>
<asp:RequiredFieldValidator ID="rfvtxtInodayspost" runat="server" ControlToValidate="txtInodayspost"
Text="" ErrorMessage="No of days 2x post is required" Display="Dynamic"></asp:RequiredFieldValidator>
</InsertItemTemplate>
<ItemStyle CssClass="DetailsViewItemStyle" />
</asp:TemplateField></pre>
推荐答案
这篇关于Detailsview文本框使用javascript在详细信息视图中更改了事件可见字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文