I have a directory for my Webforms (.aspx pages), one for my Classes (this was done for me, don't know too much about it) and one for my Moduels (my global variables).
Do I put functions I want to be global in my Class file? Do I just put it in the same way as I would put it into a webform.aspx.vb page?
I'm needing this function to connect to a database and do searches and return results etc - this is ok to do in global format?
Basically the reason why I'm doing this is my Side Naviagtion Bar has text boxes that will contain entries from the database, and rather than have the code on every page (the side nav bar is actually just a panel) I want to put it all into a global and just call the function.
Thanks!
AndrewHi Andrew
Why don't you make a UserControl that contains your Sidebar and the functionality of your sidebar? And then you 'include' the Sidebar-UserControl in every page?
Just an idea ...
The main reason is I have no idea how to use UserContol's - and doing a global function would be easier while I'm learning.
Anyone have the answer to this? Where do I put global functions?
Cheers
Andrew
Believe me, using a User Control would be much easier (and much cleaner). It is well worth studying.
This being said, you can put you global functions wherever you want. Usually, you would create a separate class with static (shared if using VB) methods to put global function that are related together.
Can I store Javascript code in a web user control? I want to create a control for the following:
<img src="http://pics.10026.com/?src=thumbnail.gif" border="0">
My thought is that I could place the control whereever I want a photo on the webpage and create two properties, one that would represent the filename the photo (photo.jpg in the example) and a second one that would represent the file (thumbnail.gif in the example).
I can also envision using a user control for my tab menu that should appear on every page. I'd like to use properties to control the variable contents of the tab menu.
Any ideas?
Of course you can put some javascript in a user control.
But if several instances of the same control must use the same script, you may consider using a separate javascript file and Page.RegisterClientScript...
Thanks for your help - I will look into using a User Control, at the moment I'll just use a global function since the side nav bar is already in all the screens and is only needing some text boxes populated.
I'm still learning and the application that will go to production won't be the final version, just a usable version that does 95% of the required actions.
Thanks again for all your help!
Andrew
0 comments:
Post a Comment