111,118
社区成员
发帖
与我相关
我的任务
分享
//前台源码
//Gridviewl里的编辑列
<asp:TemplateField FooterText="" HeaderText="">
<ItemTemplate>
<a href="#" onclick="show(<%#Eval("user_ID").ToString() %>);">
<%#GetName(Eval("user_ID").ToString()) %></a>
</ItemTemplate>
<HeaderStyle CssClass="gvheader" />
<HeaderStyle Width="60px"></HeaderStyle>
</asp:TemplateField>
//把值传到这个页面,并且打开页面
//前台源码,<head>里写
<script type="text/javascript">
function show(userid) {
var url = "页面名称?userid=" + userid + "&random=" + Math.random();
window.showModalDialog(url, window, 'dialogWidth:1000px;dialogHeight:600px;center:yes;status:no;scroll:yes;help:yes;');
location = location;
}

protected void LinkButton1_Click(object sender, EventArgs e)
{
LinkButton myB = (LinkButton)sender;
int myIndex = ((GridViewRow)myB.NamingContainer).RowIndex;//获得行号
string strid = GridView1.DataKeys[myIndex].Value.ToString();//获得id
}