Note that there are some explanatory texts on larger screens.

plurals
  1. POSelecting the text (innerhtml) from an asp.net control with jquery
    primarykey
    data
    text
    <p>i have an asp.net gridview with and icon on each row, that when clicked i wish to create a popup with editable text boxes/input fields in. and these text boxes and input fields are to contain the existing text from the row icon i just clicked on.</p> <p>i thought i could do it like this but it gets the text from classes, but not from id's see bottom row of code:</p> <pre><code>$(".imgEditFields").click(function () { var row = $(this).closest("tr"); var strServiceID = $(".clHiddenServiceID", row).text(); var strTitleOfDoc = $(document).attr('title'); var strSessionUser = strTitleOfDoc.replace("Order Tracking for ", ""); var strPSTNNumber = $(".clHiddenPSTNNum", row).text(); var strPSTNNum = strPSTNNumber.replace(/'/g, ""); $('#popupTrackerEditFields h1:first').text("Edit Record " + strPSTNNum); var strSuppOrdNo = $("#lblSupplierOrderNum", row).text(); </code></pre> <p>Below are my comments having tried several permatations of the comment/replies from you all </p> <pre><code> $(".imgEditFields").click(function () { //I get the row with the icon that was clicked on var row = $(this).closest("tr"); var strServiceID = $(".clHiddenServiceID", row).text(); var strTitleOfDoc = $(document).attr('title'); var strSessionUser = strTitleOfDoc.replace("Order Tracking for ", ""); var strPSTNNumber = $(".clHiddenPSTNNum", row).text(); var strPSTNNum = strPSTNNumber.replace(/'/g, ""); $('#PopUpTrackerEditFields h1:first').text("Edit Record " + strPSTNNum); var strSuppOrdNo = $(".clSupplierOrderNumber", row).text(); //All the above work great and i get what is expected, the problem begins blow when trying to select by //the id (in that row) //The below line achieves what i want visually but i cannot gaurantee its the correct row can i? $('#MainContent_tbPopUpEditSuppOrdNo').val(strSuppOrdNo); //The below line does not work as suggested by the replies and i have tried with HTML, val, Text etc $('#&lt;%=tbPopUpEditSuppOrdNo.ClientID%&gt;', row).html(strSuppOrdNo); //the blow works again not sure if it is selecting the correct row each time $('#MainContent_tbPopUpEditSuppOrdNo').attr('title', 'Edit your Supplier no here for ' + strPSTNNum); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload