Have you tried debugging your code to see if it hits the
OnClick
event? Looking at your code, based on this line:
<asp:LinkButton ID="lnkAdd" runat="server" Text="Add Sorting" Font-Underline="true" OnClick="lnkAddOrder_Click" Font-Names="Calibri" Font-Size="10pt" ForeColor="Black" />
You wired-up an
OnClick
event to your
LinkButton
which is named "
lnkAddOrder_Click
" but your code behind uses the name "
lnkAddSort_Click
". You should change the event name to match with the event handler you set in your markup/HTML. So you should have something like this instead:
protected void lnkAddOrder_Click(object sender, EventArgs e)
{
}
You can also refer this example on how to
[
^]create dynamic controls in ASP.NET WebForms: