【发布时间】:2014-03-26 12:24:35
【问题描述】:
我在 asp.net 页面中有一个 gridview。每列都有一个按钮,单击该按钮我使用 jquery 打开一个弹出窗口。
protected void gvExpiry_RowDataBound(object sender, GridViewRowEventArgs e)
{
if ((e.Row.RowType == DataControlRowType.DataRow))
{
Button tmp = new Button();
tmp = ((Button)e.Row.FindControl("btnTest"));
tmp.Attributes["onclick"] = "javascript:return MyFunc(" + gvExpiry.DataKeys[e.Row.RowIndex].Value.ToString() + "," + gvExpiry.DataKeys[e.Row.RowIndex].Value.ToString() + ")";
}
}
$("[id*=btnTest]").live("click", function () {
$("#modal_dialog").dialog({
close:function(event, ui){
$(this).dialog("close");
},
title: "Please enter tag",
buttons: {
Ok: function MyFunc(fileName, tag) {
//alert(fileName);
var etag = $("#<%= txttag.ClientID %>").val();
alert(typeof fileName);
alert(typeof Etag)
//other functionality
},
modal: true
});
return false;
});
但是在我的 MyFunc(fileName, Etag) 中,我没有得到正确的参数值。我是 gettng 对象和未定义的值
我怎样才能得到我的参数的正确值
【问题讨论】:
-
试试
gvExpiry.DataKeys[e.Row.RowIndex]["your_datakeyname"].Value