This code works 100% of the time, but If this sentence is written like this on the back-end side // string id = "2"; If called, record number 2 is fetched successfully.
But if it is written like this, the record cannot be retrieved.
string id = Request.Form[hfCustomerId1.UniqueID].Trim();
I thought that somehow an idno cannot be assigned to the hidden field sentence in the web design section.
I could not find a need to assign an idno to the hidden field sentence from somewhere. In this case, the idno appears empty as a result of the break point control.
<body>
<form id2="form1" runat="server">
<div>
<asp:HiddenField ID="hfCustomerId1" runat="server" />
<table style="width: 1000px">
<% foreach (var c in this.item())
{ %>
<tr>
<td class="style3">
<label><%=c.countryid%></label></td>
<td class="style3">
<input type="text" value='<%=c.countryname %>' /></td>
<td class="style3">
<input type="text" value='<%=c.photo%>' /></td>
<td class="style3">
<input type="radio" <%=c.countryname== "india" ? "checked" : "" %> /></td>
<td class="style3">
<input type="checkbox" <%=c.countryname!= "india" ? "checked" : "" %> /></td>
<td class="style4">
<a href='countrydetail.aspx?idno=<%=c.countryid %>'>country detaıl</a> </td>
<td>
<asp:Button ID="Button1" runat="server" Text="Button"
BackColor="#FF6699" Width="500px" OnClick="ON" />
</tr>
<% } %>
</table>
</div>
<hr />
<div>
<table>
<tr>
<td>
<label><%=countryidx%></label>
</td>
</tr>
<tr>
<td>
<input type="text" value='<%=ulkeismix%>' />
</td>
</tr>
<tr>
<td>
<input type="text" value='<%=photox%>' />
</td>
</tr>
</table>
</div>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(function () {
$('.View').on('click', function () {
var id = $(this).closest('tr').find('td').eq(0).text().trim();
$('[id*=hfCustomerId1]').val(id);
});
});
</script>
</form>
</body>
protected void ON(object sender, EventArgs e)
{
string id = Request.Form[hfCustomerId1.UniqueID].Trim();
}