Skip Navigation LinksHome > Categories > Code from a Category issue when adding control programmatically in a Panel

User Name: jamest85
Name: James Tang
Contact Me:
Home Page:
Google Apps for Work Partner, Certified Zoho CRM Consultant. 7 years experience on Zoho consulting, implementation, and programming using C#, VB, Php..., 15 years of total IT experience including prog... [More]
Viewed Times: 2883
Add Date: 12/23/2010
Sometime we want to add a control, for example a user control, to a panel programmatically based on conditions, but you better use yourControl.Controls.Clear() before add, also in this post, there are couple of useful code including how to response a "button" click which is in a gridview control.
Here is the screen shoot:

I notice if we keep clicking the buttons, the Quantity information under the gridview just doesn't update correctly, and I finally figure out I need add: panelPExtraInfo.Controls.Clear() to clean up the panel before add a new control in it.
Here is the code

Post a Comment

Name: (Optional)
Email: (Optional, you can get an email if somebody replys your comments)*
Email me if somebody respons my comment below:
Enter Text
as Below:
(case insensitive, if hard to read, click the "get a new one" button)
* Your email address will not be shared with any third parties for any reason.
** Maximum 1000 charactors.