日期:2014-05-18  浏览次数:20357 次

Asp.net怎么更新文本框,在线结贴.

第一次加载表格默认选中一行,第一个文本框显示的值是 表的1行1列
点击表的第4行, 显示的值还是,表的1行1列 正确结果是4.


从代码中我能得到对应的值,就是对应文本框的值不更新。(如:上图)表格的值知道,怎么获取.
有什么好的方法,能点击对应的行显示对应文本框的值.






------解决方案--------------------
你数据行都能获得了 那就直接设置文本框对象的Text呗

文本框对象你找不到?
------解决方案--------------------
如果是GridView,用c#处理的话, 至少需要重新绑定一下,绑定后定位到当前行
------解决方案--------------------
没搞懂你的意思?是不是从右边的表点击某一行,自动把线径值写到左边的文本框,
"从代码中我能得到对应的值,就是对应文本框的值不更新"这什么意思?
------解决方案--------------------
this.text1.text=gridview1.cell(4,1),....
------解决方案--------------------
文本框的id获取不了吧?貌似你用的是dev的控件,在网页中查看源文件,看看文本框的id 是什么,把只赋给它就可以了
------解决方案--------------------
这个效果没试过,我试试去,你应该是用的repeater吧
------解决方案--------------------
左边是detailView,,右边是repeater吗
那要得到id,就能显示到detailView上了吧
在加上 updatePanel无刷新行了,,
------解决方案--------------------

<script type="text/javascript" language="javascript">
function GetId(id){
document.getElementById('<%=TextBox1.ClientID %>').value=id;
location.href="Text.aspx?id="+id;
}
</script>

<div>
<div style="float: left; width: 150px;">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="125px">
</asp:DetailsView>
</div>
<div style="float: left; width: 450px;">
<table width="400" style="text-align: center;" border="1" cellpadding="5" cellspacing="0">
<tr>
<th width="100">
房间号</th>
<th width="110">
客户类型</th>
<th width="90">
床位数</th>
<th width="90">
客人数</th>
<th width="90">
状态</th>
</tr>
<asp:Repeater ID="Repeater1" runat="server" OnItemDataBound="Repeater1_ItemDataBound">
<ItemTemplate>
<tr id="row" runat="server">
<td>
<%# Eval("number")%>
</td>
<td>
<%# Eval("type.typename")%>
</td>
<td>
<%# Eval("bebnumber")%>
</td>
<td>
<%# Eval("guestnumber")%>
</td>
<td>
<%# Eval("state.StateName")%>
</td>
</tr>