这个该怎么样处理呢?给一段代码,结帖率100%.
解决方案 »
- RadComboBox 在IE8和IE9下RequiredFieldValidator 非空验证失效
- ajax 怎么让接收的页面实现多个方法。。。就46分了,都给你
- 文本框中每输入一个字符,在Grid中显示该示该内容的结果, 用 ajax怎么做?
- 诚找一ASP.NET C# 的兼职做个网站, 北京,城北立水桥附近
- RSS不会用,你们真的笨........
- datalist的动态绑定数据
- asp.net水晶报表里的图片无法显示
- 讨论一下,分页的话,为了让搜索引擎抓到,是按纽来实现分页的好,还是用链接来实现分页的好?
- 各位大神,麻烦看一下这个网站能做到自动适应PC下各种分辨率吗
- 请教一个Session的问题!!
- 文本框限制中文輸入問題
- MonoRail过滤器的疑问
{
String message = CustomersGridView.Rows[e.NewEditIndex].Cells["你要的单元格控件"].Text;
MessageBox.Show(message);
}
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("ondblclick", "alert('"+e.Row.RowIndex+1+"')");
}
}
{
protected void Page_Load(object sender, EventArgs e)
{
List<Student> studentList = new List<Student>() {
new Student(){ ID=1, Name="wang"},
new Student(){ ID=2, Name="symbol"}
}; this.GridView1.DataSource = studentList; this.GridView1.DataKeyNames = new string[] { "ID"}; this.GridView1.DataBind(); foreach (GridViewRow gvr in this.GridView1.Rows)
{
gvr.Attributes.Add("ondblclick", "alert('"+ gvr.RowIndex +"');");
}
} } public class Student
{
public int ID { set; get; } public string Name { set; get; }
}
前台就是gridview
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
取值返回的部分就ajax吧,这个楼主自己决定用什么框架
protected void gvProject_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//鼠标移上变色,离开白色
e.Row.Attributes.Add("OnMouseOut", "this.style.backgroundColor='White';this.style.color='#003399'");
e.Row.Attributes.Add("OnMouseOver", "this.style.backgroundColor='#6699FF';this.style.color='#8C4510'"); //设置悬浮鼠标指针形状为"小手"
e.Row.Attributes["style"] = "Cursor:hand";
//点击取值,并返回父窗口
e.Row.Attributes.Add("onclick", "parent.set_Project(\"" + e.Row.Cells[1].Text + "\",\"" + e.Row.Cells[0].Text + "\");parent.close1();");
}
}
紧供参考
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
//假设你要获取当前行第一列的值!
e.Row.Attributes.Add("ondblclick","alert('"+e.Row.Cells[0].Text.ToString()+"')"); }
}