简体   繁体   中英

Navigating to other page clicking on a image passing values

I am new to .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.

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

   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

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. 例如 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.

<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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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