我一直在得到这个信息,并且没有任何帮助可以解决这个错误,我正在创建按钮的动态控件OnClick
。但是收到此错误,发现多个具有相同ID的控件。 FindControl
要求控件具有唯一的ID 。
protected void RadAjaxManager1_AjaxRequest(object sender, Telerik.Web.UI.AjaxRequestEventArgs e)
{
string commandText = e.Argument.ToString().Trim();
string[] splitdata = commandText.Split('&');
commandText = splitdata[0];
string controlName = splitdata[1];
switch (controlName)
{
case "RadTextBox":
int cnt1 = FindOccurence("rtb") + 1;
TableCell txtlblRad = dCBL.GetWebUIControl("RadLabel", "", cnt1, cnt1, "Text Box:", "", 0,"");
TableCell txtRad = dCBL.GetWebUIControl("RadTextBox", "", cnt1, cnt1, "", "", 0,"");
TableRow txtRow = new TableRow();
txtRow.Cells.Add(txtlblRad);
txtRow.Cells.Add(txtRad);
Table1.Rows.Add(txtRow);
break;
}
}
private void RecreateControls(string ctrlPrefix, string ctrlType)
{
string[] ctrls = Request.Form.ToString().Split('&');
int cnt = FindOccurence(ctrlPrefix);
if (cnt > 0)
{
for (int k = 1; k <= cnt; k++)
{
for (int i = 0; i < ctrls.Length; i++)
{
if (ctrls[i].Contains(ctrlPrefix + "_" + k.ToString()))
{
if (ctrlType == "RadTextBox")
{
TableCell txtlblRad = dCBL.GetWebUIControl("RadLabel", "", k, k, "TextBox:", "", 0,"");
TableCell txtRad = dCBL.GetWebUIControl("RadTextBox", "", k, k, "", "", 0,"");
TableRow txtRow = new TableRow();
txtRow.Cells.Add(txtlblRad);
txtRow.Cells.Add(txtRad);
Table1.Rows.Add(txtRow);
}
}
}
}
}
private int FindOccurence(string substr)
{
string reqstr = Request.Form.ToString();
return (((reqstr.Length - reqstr.Replace(substr, "").Length) / substr.Length) / 2);
}