A
Angelo
Hi,
I'm using a WebUserControl which build a table . In that table , there r
some LinkButton Controls which handle an event . For the fitst time my
program run properly , but for the second , systm show me this error . "
An error has occurred because a control with auto-generated id
'WebUserControl11:_ctl2' could not be located to raise a postback event. To
avoid this error, explicitly set the ID property of controls that raise
postback events. "
the make it more clear , i pase some parts of my code here .
private void CreateLables()
{
int intDivide;
try
{
//Create Counter LinkButton Lables
intDivide=Convert.ToInt32(MainSize)/3;
intDivide=intDivide+1;
LinkButton[] ocConters;
Table LastTable=new Table();
ocConters=new LinkButton[intDivide];
TableCell[] ocTableCell=new TableCell[intDivide];
TableRow ocTableRow =new TableRow();
for (int intNum=0;intNum<intDivide;++intNum)
{
ocConters[intNum]=new LinkButton();
ocConters[intNum].Click += new
System.EventHandler(this.LinkButton_Click);
ocConters[intNum].Text=Convert.ToString(intNum+1);
ocTableCell[intNum]=new TableCell();
ocTableCell[intNum].Controls.Add(ocConters[intNum]);
ocTableRow.Cells.Add(ocTableCell[intNum]);
}
LastTable.Rows.Add(ocTableRow);
this.Controls.Add(LastTable);
}
catch (Exception ocException)
{
throw (ocException);
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void LinkButton_Click(object sender, System.EventArgs e)
{
this.Controls.Clear();
try
{
Products ocProducts=new Products();
for (int intNum=0;intNum<intDivide;intNum++)
{
if (
sender.Equals(ocConters[intNum]))
{
ocProductData=ocProducts.FillForm(intNum,false);
MakeProductTable(ocProductData,2);
}
}
}
catch (Exception oc)
{
Response.Write(oc.ToString());
}
}
What should i do . plzzzzzzzzz HELP
Regard
Angelo
I'm using a WebUserControl which build a table . In that table , there r
some LinkButton Controls which handle an event . For the fitst time my
program run properly , but for the second , systm show me this error . "
An error has occurred because a control with auto-generated id
'WebUserControl11:_ctl2' could not be located to raise a postback event. To
avoid this error, explicitly set the ID property of controls that raise
postback events. "
the make it more clear , i pase some parts of my code here .
private void CreateLables()
{
int intDivide;
try
{
//Create Counter LinkButton Lables
intDivide=Convert.ToInt32(MainSize)/3;
intDivide=intDivide+1;
LinkButton[] ocConters;
Table LastTable=new Table();
ocConters=new LinkButton[intDivide];
TableCell[] ocTableCell=new TableCell[intDivide];
TableRow ocTableRow =new TableRow();
for (int intNum=0;intNum<intDivide;++intNum)
{
ocConters[intNum]=new LinkButton();
ocConters[intNum].Click += new
System.EventHandler(this.LinkButton_Click);
ocConters[intNum].Text=Convert.ToString(intNum+1);
ocTableCell[intNum]=new TableCell();
ocTableCell[intNum].Controls.Add(ocConters[intNum]);
ocTableRow.Cells.Add(ocTableCell[intNum]);
}
LastTable.Rows.Add(ocTableRow);
this.Controls.Add(LastTable);
}
catch (Exception ocException)
{
throw (ocException);
}
}
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void LinkButton_Click(object sender, System.EventArgs e)
{
this.Controls.Clear();
try
{
Products ocProducts=new Products();
for (int intNum=0;intNum<intDivide;intNum++)
{
if (
sender.Equals(ocConters[intNum]))
{
ocProductData=ocProducts.FillForm(intNum,false);
MakeProductTable(ocProductData,2);
}
}
}
catch (Exception oc)
{
Response.Write(oc.ToString());
}
}
What should i do . plzzzzzzzzz HELP
Regard
Angelo