简体   繁体   English

导航到其他页面,单击传递值的图像

[英]Navigating to other page clicking on a image passing values

I am new to .NET/ JS . 我是.NET / JS的新手。 I have an .aspx page where we will have to navigate to other page when clicking on the image on the table.So while clicking(or navigating to the other page) we will have to pass the values from other columns of the same row we are clicking. 我有一个.aspx页面,在单击表上的图像时我们必须导航到另一页面,因此在单击(或导航到另一页面)时,我们必须传递同一行其他列的值在点击。

So the Table has the columns like 因此,表格具有类似 在此处输入图片说明 So the Action has the icon which will be navigating to the other page. 因此,该操作具有将导航到另一页面的图标。 But I will need to pass the Task Name and Last Run values along.Currently I did 但是我需要传递Task Name和Last Run值。

   function dataReview_tasks(obj) {
        var i = 0;
        var data_FileKeys = new Array();
        $('.chkImport')
            .each(function (index, value) {
                if ($(this).attr('checked')) {
                    var info = new IOInfo(this);
                    data_FileKeys[i] = info.key(0);
                    i++;
                }
            });
           window.location = '<%= ResolveUrl("~/GUI/DataReviewNEW.aspx") %>';
    }

I understand we can pass values as ?col1=values but not sure how would we can make them as the values from the table.Any help is greatly appreciated 我知道我们可以将值作为?col1 = values传递,但不确定如何将它们作为表中的值传递。非常感谢您的帮助

You can have the table store values for every row in data attribute of anchor tag (action with icon) if you don't want the id to be visible on screen. 如果您不希望该ID在屏幕上显示,则可以在锚标记的data属性(带图标的操作)中为表格的每一行存储值。 例如 As in above image you can see the edit button which upon click will redirect to another page allowing to edit the information. 如上图所示,您可以看到“编辑”按钮,单击该按钮将重定向到另一个页面,可以编辑信息。 Following is the generated html of that anchor. 以下是该锚点的生成的html。

<a data-toggle="tooltip" data-placement="top" data-original-title="Edit" class="btnWorkstationEdit Pointer" data-workstationid="70062"></a>

Now in order to get the id in jquery you can probably do something like 现在,为了获取jquery中的ID,您可能可以执行以下操作

function dataReview_tasks(obj) {       
    $('.btnWorkstationEdit').click(function{
             window.location = '<%= ResolveUrl("~/GUI/DataReviewNEW.aspx?"'+$(this).attr('data-workstationid')+'"") %>';
     });            
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM