使用webuser控件的好主意是什么? [英] What is the great idea to use webuser control ?
问题描述
Hii,
我想知道如何准确使用webuser控件。
比方说我想显示同一页面根据公司和员工角色进行一些逻辑更改,处理用户控件cs文件中的所有逻辑或从父页调用每个usercontrols方法并传递其中的参数是好的,
哪个是最好的处理方式./。
如果我直接处理webusercontrol中的逻辑我不需要在我的父cs文件上写任何东西,但如果我从父页面调用那些方法,那么我必须编写并调用方法并将参数传递给它..
请建议
Hii ,
I want to know how to use webuser control exactly .
Say for example i want to show the same page with some logical changes as per company and employees role , is it good to handle all logic in user controls cs file or call each usercontrols methods from parent page and pass the parameters in it ,
Which is the best deal to work with it ./.
IF i directly handle the logic in webusercontrol i dont need to write anything on my parent cs file , but if i am calling those methods from parent page then i have to write and call the methods and pass the parameters into it ..
please suggest
推荐答案
你不需要调用 UserControl $ c的方法$ C>。 UserControl
已有 Page_Load
事件。根据您的逻辑,只需执行 Page_Load
UserControl
事件中的方法。
所以,你可以处理 UserControl
Code Behind内的所有内容。
You don't need to call methods ofUserControl
.UserControl
already hasPage_Load
Event. According to your Logic, just execute the methods insidePage_Load
Event ofUserControl
.
So, you can handle everything inside theUserControl
Code Behind.
这篇关于使用webuser控件的好主意是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!