|
I don't think there is right or wrong. Since the logic should be stateless using static functions would be the right choice for the business logic. Using non-static functions would be good if you think about using abstract classes and inheritance within your business logic. For myself I use the strategy pattern really often within my business logic, so i implemented non-static functions/methods.
For the data layer I wouldn't use static functions, since the data access has to handle the connection and all transactions within. So for me the Data Access Layer is not stateless which implies using non-static functions/methods.
But it all depends on your personal favor (and the requirements of course).
Hope this helps you a bit.
Regards
Sebastian
|
|
|
|
|
SeMartens wrote: So for me the Data Access Layer is not stateless which implies using non-static functions/methods.
But DataAccessBlock provided by microsoft contains all methods as static....??
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Well, as I said it is a bit of personal favor...
|
|
|
|
|
No, the facade to it is static, but if you dig deep the actual work is done by an instance of a concrete class.
I think... not looked in a while, but its how i'd do it
|
|
|
|
|
how can i change the bg color of a master page from one of its child page programatically
Thanx in advance
|
|
|
|
|
Add this to you content.aspx <%@ MasterType VirtualPath="~/MasterPage.master" %> (using the correct name and path)
then you can access your masterpage from the contentpage using Master.WhateverMasterControlYouWantToAccess .
|
|
|
|
|
First of all thanx for the response
I have added the <@ MasterType VirtualPath="~/MasterPage.master" %> in the content page.
and in the master page the body tag has an id="bodycol" and runat="server"
Now to change the bgcolor of the master page what i should do.
Master.bodycol.Attributes["bgcolor"]="Red";
is not working
|
|
|
|
|
You can use Master.bodycol.Style(System.Web.UI.HtmlTextWriterStyle.BackgroundColor) = "Red"
|
|
|
|
|
i have used your code but it is giving an error.that
MasterPage.bodycol is not accessible in this context because it is Protected
|
|
|
|
|
True, you have to wrap it in a public or friend property and access the property from the content page.
|
|
|
|
|
i am using it like following,
Public Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Master.bodytag.Style(System.Web.UI.HtmlTextWriterStyle.BackgroundColor) = "Green"
End Sub
And it is giving the error
how can it be wrapped in a friend property.
|
|
|
|
|
You can do it like this.
Put this one in the master:
Public WriteOnly Property ChangeColor() As Boolean
Set(ByVal value As Boolean)
bodytag.Style(System.Web.UI.HtmlTextWriterStyle.BackgroundColor) = "Green"
End Set
End Property
And in the contentpage you call it with:
Public Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Master.ChangeColor = true
End Sub
I know, it's a bit ugly...
|
|
|
|
|
Thanx a lot sir for your constant guidance.At last it is working fine.
Thanx again
|
|
|
|
|
|
Where to add this code <%@ MasterType VirtualPath="~/MasterPage.master" %>
In master page or the web page?
|
|
|
|
|
|
Where is the content page? I have only content place holder?
|
|
|
|
|
The content page is what goes inside the content place holder.
Maybe you should read[^] up on it a bit.
|
|
|
|
|
Put all Master page content in a div control with ID and runat="server"
inside form like :
Form opening TAG
DIV u will put
all page stuff
DIV close TAG
Form Close tag
and then use following in your content page code where u wish to change the bgColor for master page
CType(Me.Page.FindControl("ctl00$div1"), HtmlGenericControl).Style.Add("background-color", "Yellow")
where div1 is the DIV control ID in ctl00$div1
With Thanks & Regards
Amit Sk Sharma
|
|
|
|
|
hi
how to give fore color in label through codebehind
sara
Known Is Drop.Unknown Is Ocean
|
|
|
|
|
What have you tried ? The control HAS a fore color property, do you try anything for yourself, or just post here ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|
|
Label1.ForeColor = System.Drawing.Color.Red; or any color u need
|
|
|
|
|
Shut down your computer, have good sleep wake up tomorrow search some good institutions and join and learn the basics first.
After 3-5 months training post your questions.
But before that use www.google.com and search , if u didn't get any answers then post here.But for god sake google at least 10 -15 min.
“You will never be a leader unless you first learn to follow and be led.”
–Tiorio
"Coming together is a beginning, staying together is progress, and working together is success." Henry Ford
|
|
|
|
|
Hi,
if i have the ip address then how can i find the geographical location of that perticular IP address
thanks,
|
|
|
|
|
With a geolocation database.
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
|
|
|
|