Click here to Skip to main content
15,883,705 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hey all , im working on a discussion board in which i place a collection of dynamic post and comment in a place holder ,
it works will until i added the content of each post in a table , it starts to throw this exception :

VB
Server Error in '/' Application.
An error has occurred because a control with id 'ctl00$Content$ctl62' could not be located or a different control is assigned to the same ID after postback. If the ID is not assigned, explicitly set the ID property of controls that raise postback events to avoid this error.


what shall i do?

pleas help! its more than urgent !!
Posted

Before adding any new control in your container control(like Page, Panel...), You have to make sure that the control is exists or not. How ?

C#
/// <summary>
/// Check a control is exists or not
/// </summary>
/// <param name="container">Container control value</param>
/// <param name="controlID">ControlID value</param>
/// <returns>True/False</returns>
public bool IsControlExists(Control container, string controlID) {
    if (container != null && container.HasControls())
        if (container.FindControl(controlID) != null)
            return true;
    return false;
}


So before adding any control in you container control, make sure to check existence by calling this method.

I hope this helps you well.
 
Share this answer
 
Comments
hebaSaleh 21-May-11 9:45am    
i've got it ,thank alot Wonde Tadesse
i appreciate your help! i'll try it and inchalla its gonna work
Wonde Tadesse 6-Dec-11 10:47am    
Thanks.
OP wrote: pleas help! its more than urgent !!

If it really was you would have searched Google for the error message[^].

Read the discussions. I am sure they will solve your problem.
 
Share this answer
 
Comments
hebaSaleh 21-May-11 9:25am    
i did , and tried many many solution , but still i have the same error ,

any way thx

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900