第一次加载表格默认选中一行,第一个文本框显示的值是 表的1行1列
点击表的第4行, 显示的值还是,表的1行1列 正确结果是4.
从代码中我能得到对应的值,就是对应文本框的值不更新。(如:上图)表格的值知道,怎么获取.
有什么好的方法,能点击对应的行显示对应文本框的值.
解决方案 »
- 再来一次(存储过程)
- 论坛的查看帖子和回复怎么做的啊?
- 搜索asp.net ajax框架 ajaxpro
- |M| 我用enum 的时候发现 这个东西很没有用 还不如用Class
- pivottable ,olap 的问题
- 自绘表格
- ------ 进来告诉我就给你分!!! 菜鸟,初学问题!!!!
- SqlParameterCollection 仅接受非空的 SqlParameter 类型对象,不接受 Int32 对象。System.Data
- 建asp.net项目的系统异常
- 请教各位如何获取DataGrid所有显示列的的字段名称,谢谢!(在线等待)
- 取不到
- C#如何将数据添加到GridView对应的行和列中
那要得到id,就能显示到detailView上了吧
在加上 updatePanel无刷新行了,,
/// <summary>
/// 绑定线路表xml
/// </summary>
void bindLine(string shapeType)
{
dsLine= new DataSet();
dsLine.ReadXml(Server.MapPath(xmlpath));
this.gridLine.DataSource = dsLine.Tables[shapeType];
this.gridLine.DataBind();
} protected void gridLine_FocusedRowChanged(object sender, EventArgs e)
{
key = gridLine.FocusedRowIndex;//获得选中行的索引
string ID = this.gridLine.GetRowValues(key, "ID").ToString();
nudCONDUCTD.Text = dsLine.Tables["LINE_PARA"].Rows[key][0].ToString();
}能获得值。经过 调试 点哪行,能得到对应的值,如:点第4行,程序显示nudCONDUCTD.Text=4正解
就是控件没刷新,问大家有什么好方法
<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>
</ItemTemplate>
</asp:Repeater>
</table>
</div>
</div>protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.Repeater1.DataSource = RoomManager.GetAllRoom();
Repeater1.DataBind();
if (Request.QueryString["id"] != null) {
int id = Convert.ToInt32(Request.QueryString["id"]);
List<Room> list = new List<Room>();
list.Add(RoomManager.GetRoomById(id));
this.DetailsView1.DataSource = list;
this.DetailsView1.DataBind();
}
}
}
protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
HtmlTableRow row = (HtmlTableRow)e.Item.FindControl("row");
if (row != null)
{
row.Attributes.Add("onmouseover", "a=this.style.backgroundColor;this.style.backgroundColor='#6699ff'");
row.Attributes.Add("onmouseout", "this.style.backgroundColor=a");
Room rowv = (Room)e.Item.DataItem;
int rid = rowv.RoomId;
row.Attributes.Add("onclick", "GetId('" + rid + "')");
}
}
希望对你有点帮助,,,,
2.文本框在事件里重新赋值了之后,在page_load事件里又再次被赋初始值,导致文本框“貌似”未刷新?