简体   繁体   中英

Unable to fire LinkButton_Click Event

Actually,I'm Dynamically generating Controls and adding them to a Panel . Now,I'm showing my Records Count in a LinkButton and on LinkButton_Click ,I'm showing the actual Records.
On the Page_Load ,the data is Binding Perfect and all the controls gets added to the Panel .
But after clicking the LinkButton ,It is not entering the LinkButton_Click event.
I'm getting an error after the Page_Load event like :

The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters.

It doesn't even enter into Catch Block .

My LinkButton code :

LinkButton lblCount = new LinkButton() { ID = "lblCount" + j + i + 1, Text = ans_count.ToString() };
//lblCount.EnableDefaultAppearance = false;
lblCount.EnableTheming = false;
lblCount.ForeColor = Color.Black;
lblCount.Font.Bold = true;
lblCount.Font.Underline = true;

string strval = String.Format("{0}~{1}~{2}", tempid, questionid, answerid);
lblCount.CommandArgument = strval;
lblCount.Click += new EventHandler(this.LbtnCount_Click);
Panel_Answers.Controls.Add(lblCount);

我认为您需要在OnInit事件中添加控件而不是页面加载,请尝试一下

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM