<tr>
<td align="right" width="80">大分类:
</td>
<td width="180">
<asp:RadioButtonList ID="kind1" runat="server" RepeatColumns="0" RepeatDirection="Horizontal">
<asp:ListItem Value="收入" Text="收入"></asp:ListItem>
<asp:ListItem Value="支出" Text="支出"></asp:ListItem>
</asp:RadioButtonList>
</td>
<td rowspan="3" width="240"></td>
</tr>
<!--隐藏行-->
<tr id="qty" style="display:none">
<td align="right">预计月消费:
</td>
<td><asp:TextBox CssClass="textbox1" Width="170px" MaxLength="30" ID="mconsume" EnableViewState="False" runat="server" ToolTip="预计本月该小项的消费量,后续可更改"></asp:TextBox>
</td>
</tr>
当选择“支出”,隐藏行显示;选择“收入”,又隐藏,这要怎么实现呢
或者将textbox设为只读也行
<td align="right" width="80">大分类:
</td>
<td width="180">
<asp:RadioButtonList ID="kind1" runat="server" RepeatColumns="0" RepeatDirection="Horizontal">
<asp:ListItem Value="收入" Text="收入"></asp:ListItem>
<asp:ListItem Value="支出" Text="支出"></asp:ListItem>
</asp:RadioButtonList>
</td>
<td rowspan="3" width="240"></td>
</tr>
<!--隐藏行-->
<tr id="qty" style="display:none">
<td align="right">预计月消费:
</td>
<td><asp:TextBox CssClass="textbox1" Width="170px" MaxLength="30" ID="mconsume" EnableViewState="False" runat="server" ToolTip="预计本月该小项的消费量,后续可更改"></asp:TextBox>
</td>
</tr>
当选择“支出”,隐藏行显示;选择“收入”,又隐藏,这要怎么实现呢
或者将textbox设为只读也行
解决方案 »
- asp.net网站开发
- 对路径“E:\xx\images”的访问被拒绝。
- 开启SQL2005使用SQL用户身份验证(SA)
- 我写了个数据库访问类,大家看看好好好,觉得不合理的请指出来,谢谢
- 怎么搞才能得到ProductID的值,谢谢高人指点!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11
- 在datagrid中传多个值
- 在VS.NET环境中,在设计时怎样调整一个WEB窗体的大小?
- js代码 在浏览器中的运行 有理即给分
- 请教一个概念问题
- 如何在运行时测试connection字符串是否正确?
- 高分请教用户控件问题
- 如何在程序中实现DTS 将access库导入到sqlServer中
<title></title>
<script language="javascript">
function hiddenRow()
{
document.getElementById("qty").style.visibility = "hidden";
}function showRow()
{
document.getElementById("qty").style.visibility = "visible";
}
</script>
</head><body>
<tr>
<td align="right" width="80">大分类:
</td>
<td width="180">
<input type="radio" name="radiobutton" value="radiobutton" onclick="javascript:showRow()" />
支出
<input type="radio" name="radiobutton" value="radiobutton" onclick="javascript:hiddenRow()" />
收入
</td>
<td rowspan="3" width="240"></td>
</tr>
<div id="qty">
<!--隐藏行-->
<tr style="display:none">
<td align="right">预计月消费:
</td>
<td><asp:TextBox CssClass="textbox1" Width="170px" MaxLength="30" ID="mconsume" EnableViewState="False" runat="server" ToolTip="预计本月该小项的消费量,后续可更改"></asp:TextBox>
</td>
</tr>
</div>
</body>
</html>
<table>
<tr>
<td align="right" width="80">大分类:
</td>
<td width="180">
<asp:RadioButtonList ID="kind1" runat="server" RepeatColumns="0" RepeatDirection="Horizontal" AutoPostBack="True">
<asp:ListItem Value="收入">收入</asp:ListItem>
<asp:ListItem Value="支出">支出</asp:ListItem>
</asp:RadioButtonList>
</td>
<td rowspan="3" width="240"></td>
</tr>
<asp:Panel id="Panel1" runat="server"> <!--隐藏行-->
<TR>
<TD align="right">预计月消费:
</TD>
<TD>
<asp:TextBox id="mconsume" runat="server" ToolTip="预计本月该小项的消费量,后续可更改" EnableViewState="False"
MaxLength="30" Width="170px" CssClass="textbox1"></asp:TextBox></TD>
</TR>
</asp:Panel>
</table>
</form>服务器端RadioButtonList的SelectedIndexChanged事件cs代码
private void kind1_SelectedIndexChanged(object sender, System.EventArgs e)
{
if (this.kind1.SelectedValue.Trim() == "收入")
this.Panel1.Visible = false;
if (this.kind1.SelectedValue.Trim() == "支出")
this.Panel1.Visible = true;
}
不过有个问题,设置AutoPostBack="True",就会往服务器回传,这样有点讨厌
我是想能不能给radiobuttonlist绑定一个js在客户端处理,据说radiobuttonlist上绑定js比较麻烦,不知道有什么方法