开发者

how to retrieve the row value on click

 var RowClick = function() {
    ("#Grid").click(开发者_如何学C
         var  s = $("#Grid").jqGrid('getGridParam', 'selarrrow').toString();
         alert(s);
            $("#showgrid").load('/Inventory/Products/List/' + s));
    };

on RowClick i am trying to get the value of that row to send throw URL.. to access this Row value in my Actionresult method. but I am getting null value for the row? is this right what I am doing here?

When I am doing something like this..

var value;
$("#Grid").click(function(e) {
                    var row = jQuery(e.target).parent();
                    value= row.attr("id");
});
    var RowClick = function() {
    ("#Grid").click(
            $("#showgrid").load('/Inventory/Products/List/' + value));
    };

on alert I am getting the row value perfectly but in my action result method It's showing me null value?

Public Actionresult List(string value)
{
  return View();
}


.click() takes a function as a parameter, so maybe what you want is this:

var RowClick = function() {
    var  s = $(this).jqGrid('getGridParam', 'selarrrow').toString();
    alert(s);
    $("#showgrid").load('/Inventory/Products/List/' + s));
}
$('#Grid').click(RowClick)

Alternately, just pass in your function as an anonymous function:

$('#Grid').click(function(){
    var  s = $(this).jqGrid('getGridParam', 'selarrrow').toString();
    alert(s);
    $("#showgrid").load('/Inventory/Products/List/' + s));
});

It would be worthwhile to look at .bind() as an alternate syntax to bind events, it comes up if you want to bind the same function to different events.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜