I m creating dynamic controls in my page due to which on my button click , m getting this error.. Please need urgent help..
ItemTag validation (_tkn_18): Reference token (buttonXXX_ClientInit) was not found.
I m creating dynamic controls in my page due to which on my button click , m getting this error.. Please need urgent help..
ItemTag validation (_tkn_18): Reference token (buttonXXX_ClientInit) was not found.
Hi @AshwiniRane,
I guess you use DirectEvents of a dynamically created controls. During its execution a DirectEvent requires a control instance on server. So, to be able to use a DirectEvent is such the scenario you should recreate the controls.
As an alternative, you can use a combination of a client side listener and a DirectMethod. In this way you will be able to hip the server, but you won't be obligated to recreated the controls.
Thanks you so much for a quick turnaround.. But can you explain it in brief?? Should I replace DirectEvents with DirectMethods? Will that work when I m clicking on my dynamic button?
Yes, DirectMethods may be a better option if you are dynamically creating controls.
DirectEvents require the Control to be recreated upon each request (ASP.NET requirement), but a DirectMethod has a little more flexibility.
Hope this helps.
If I m using Direct Methods.. It is still giving the same error.. M really struggling with this since very long.. Please need help.
I have attached my sample code below.
Code:Ext.Net.Button submm = new Ext.Net.Button();
if (item2.Attributes["ID"].Value == Convert.ToString(Session["SubMenuID"]))
{
submm.Style.Add("background", "#416da3");
// submm.Cls = "my-style";
}
submm.Text = item2.Attributes["Text"].Value;
submm.ID = "btn" + item2.Attributes["Text"].Value;
Ext.Net.Parameter grantType11 = new Ext.Net.Parameter();
grantType11.Value = item2.Attributes["href"].Value;
grantType11.Name = "granturl";
//submm.DirectEvents.Click.ExtraParams.Add(grantType11);
//submm.DirectEvents.Click.Event += Get_Menu;
submm.Listeners.Click.Fn = "Ext.net.DirectMethods.Get_Menu(" + grantType11 + ")";
tree.Items.Add(submm);
public void Get_Menu(string url)
{
X.Redirect(url);
}
Please check this error.. Attachment 13001
The code sample you have posted appears to be correct.
Please help me to solve this error.. M unable to proceed.
M creating dynamic panel with accordion layout in page.. for which I m appending these dynamic buttons.. If u see, my panel and my buttons are dynamic and I m rendering them to a static FormPanel defining it as Layout = "AccordionLayout". Is this the area of problem?? I need to track this as soon as possible.