如何获取Gridview某列的值 如何获取Gridview某列的值?即将鼠标放至其某一行时,在后台获取到指定列的值? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 你想做什么?其实这是可以的,你想啊,他渲染到客户端,还是普通的Html。由此,添加一些相关内容不就可以了吗 一般是通过点击某一列,后台可以获取该列的INDEX,通过INDEX来对改列的某值进行操作。 这个东西不能理解为鼠标放到哪一行,应该具体到某一列,某个字段,这样处理的话再利用jquery结合ajax就很容易做出来了 protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e) { string id = GridView1.Rows[e.NewEditIndex].Cells[0].Text; Response.Redirect("TempletEdit.aspx?id=" + id); } GridView.Rows[行索引].Cells[列索引].Text//这是获取某行某列的值 即将鼠标放至其某一行时,在后台获取到指定列的值?点击吧。?<asp:GridView ID="GridView5" runat="server" AutoGenerateColumns="False" onrowdatabound="GridView5_RowDataBound" > <Columns> <asp:TemplateField> <ItemTemplate> <%#DataBinder.Eval(Container,"DataItem.ID") %> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> <asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>protected void GridView5_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { e.Row.Attributes.Add("style", "cursor:pointer"); e.Row.Attributes.Add("onclick", "document.getElementById('TextBox5').value=" + e.Row.RowIndex + ""); } }点击获取行号然后在根据行号去FindControl 找值。如果数据移动 也可以给鼠标加移动获取事件 但是这样应该会很卡。 gview.Rows[e.行索引].Cells[列索引].Text asp.net里面一个Ajax的问题 在等待程序执行时遇到无效的返回代码 关于网页布局的问题 javascript 的小问题谁来帮下啊?? 数据类型转换的问题 把excel导入到GridView不能分页吗? datagrid的编辑问题 ASPnetMenu1 菜单的样式怎么设置???? 这个函数好不好?我全站都要用这个,效率怎么样?大哥大姐有空来看一下, 如何在客户端动态改变按钮的边框颜色? 如何用Gridview实现超链接的文件打开效果 B/S排课系统的细节问题?
{
string id = GridView1.Rows[e.NewEditIndex].Cells[0].Text;
Response.Redirect("TempletEdit.aspx?id=" + id);
}
点击吧。?<asp:GridView ID="GridView5" runat="server" AutoGenerateColumns="False" onrowdatabound="GridView5_RowDataBound" >
<Columns>
<asp:TemplateField>
<ItemTemplate>
<%#DataBinder.Eval(Container,"DataItem.ID") %>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>protected void GridView5_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("style", "cursor:pointer");
e.Row.Attributes.Add("onclick", "document.getElementById('TextBox5').value=" + e.Row.RowIndex + "");
}
}
点击获取行号
然后在根据行号去FindControl 找值。如果数据移动 也可以给鼠标加移动获取事件 但是这样应该会很卡。