Should I use user controls if I don't use the code?

First of all, I hope that I will get some tips about my practice, because, based on the very few books that I read, they wrote little on the aspx page. They just created some controls and used them on an aspx page, so is this approach a good practice?

here is my question, I thought that using web controls instead of directly writing to the .aspx page is better since I can reuse the code, but now I create these controls and I don’t think I will use them again or maybe only once more. since it seems reasonable to you to create a control for the code instead of directly coding the .aspx page?

I also worked on a web user control to add a new element to my db, and then started planning on updating or editing control. I thought that perhaps I would use the same control to add and edit and start reusing my code, and along the way of editing the control so that it can function as the control of adding and editing, I started by adding properties to to the control, then a few assignments in the Load method, then some checks with if ... Therefore, I realized that a new control would be better!

I don’t know, I think intuitively, but I really could use a professional, experienced point of view.

Thanks for your time =)

+5
3

, ui . , . , , Login, "" , !

+7

, - . .

, , .

+1

If you know for sure that you intend to use the control (or some minor variations), then creating a custom control is not a problem.

For me, if it seems to me that I might need similar functionality again in some future project, I sometimes create a control only because I think it will be useful.

+1
source

All Articles