For example at the loop below i want to assign buttons custom variable in order to determine which button clicked on click event with jquery
Here the code :
<% for (int i = 0; i < dsProjeler.Tables[0].Rows.Count; i++)
{
lblProjeName.Text = string.Format("<a target=\"_blank\" href=\""
+ dsProjeler.Tables[0].Rows[i]["link"].ToString() + "\">{0}</a>",
dsProjeler.Tables[0].Rows[i]["baslik"].ToString());
%>
<tr>
<td>
<asp:Literal ID="lblProjeName" runat="server"></asp:Literal>
</td>
<td>
<asp:Button CssClass="sinifKatil" runat="server" Text="Katılmak İstiyorum" OnClick="btnKatil_Click" />
<asp:Button CssClass="sinifAyril" runat="server" Text="Ayrılmak İstiyorum" OnClick="btnAyril_Click" />
</td>
</tr>
<% } %>
So the real question is assigning custom variables to <asp:Button objects in the loop for in order to use those variables at on click event. The variables that can be read.
ASP.net 4.0, C# 4.0, HTML, javascript, Jquery
Consider using a Repeater control instead of the scriplet and pass your custom variable to the CommandArgument property of sinifAyril and sinifAyril buttons. Here is an example how the variable can be retrieved in the click handler