hello,
my button is inside listview and i want to pass label id of row inside listview to query string
this code works fine when button is outside listivew but how can i check which row of listview click and pass the same label id to query string thanks
<asp:ListView ID="ListView1" runat="server">
<ItemTemplate>
<asp:Label runat="server" ID="lblQueryString" Text='<%#Eval("ID") %>'></asp:Label>
<asp:Button ID="btnChange" Text="Change Query String" runat="server" />
</ItemTemplate>
</asp:ListView>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('[id*=btnChange]').on('click', function () {
var id = $(this).closest('tr').find('[id*=lblQueryString]').html();
var oldURL = window.location.protocol + "//" + window.location.host + window.location.pathname;
var newUrl = oldURL + "?Id=" + id;
if (window.history != 'undefined' && window.history.pushState != 'undefined') {
window.history.pushState({ path: newUrl }, '', newUrl);
}
return false;
});
});
</script>