Creating Dynamic Menus - calling extern Function
I got a requirement to create a dynamic menus using extern function so, we can consume it anywhere, following is the complete requirement :
Please create a dynamic horizontal link menu in the top of the Master Page. This will be the menu that is displayed on every page. We need to be able to set the links on this page from the code behind. The information we want to set is the link text, and the link path (href). The idea behind this is that based on who is logged into the application, and what page they are开发者_开发知识库 on, there will be different link possibilities. We should make this code reusable. The procedure to actually lay out the links would look something like this:
public static extern void SetDynamicLinks(Control ContainingControl, string[] arLinkTitles, string[] arLinks) { …code… }
We would call a procedure from the Page_Load of the Master Page that would decide what links we need to display. This procedure would be application dependant. This procedure would then call the "SetDynamicLinks" procedure mentioned above passing it the required parameters to make the correct links in the passed container control.
Any help for above, will be most appreciated. Thanks in advance.
The question does not make sense, if that is what you have been asked to do, then you would assume that either:
that there is already a SetDynamicLinks method developed by somebody else and lives in an unmanaged external dll, hence you would use extern to call that..
or, they are asking you to create that unmanaged dll in say C++, that will contain the SetDynamicLinks method and then can be called by other people using extern..
精彩评论