|
I want global variables to be declared ..where should I do it ???
|
|
|
|
|
If you want to hold globaly any object (value) in web application then you can use Application variable in web application.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
I want variables not objects
|
|
|
|
|
You can store any thing in Application variable. I think you don't have much information about Application in web application.
For getting more information about Application find in google.
Parwej Ahamad
g.parwez@gmail.com
|
|
|
|
|
i under stand ur problem ,
the best way to use the variable u need on all most all the forms is:
make static varible in on class and use where ever u need to want to use it value or set its value as uer requirement.
Note define that as public in class.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
|
public static class MyGlobalVariables
{
public static int someVariable;
}
NOTE: This can be an indication of poor design - You should not be thinking in terms of global variables.
What you need to do is to think of what the purpose of the variable is and find out which class it should belong to. Put it there and have the class control access to it via a property.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
thanks ..Im taking your sugesstion given in note
|
|
|
|
|
Great.
Colin Angus Mackay wrote: have the class control access to it via a property.
I heard writing properties inside class as a bad habit ? What do you say ?
|
|
|
|
|
Who told you that? Properties are not a bad habit at all - they allow you to hide the implementation of setting and retrieving values.
To a certain extent, properties are just syntactic sugar hiding the fact that these are internally functions called set_... and get_....
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Thanks, But I read some where like exposing class variables through properties is a bad habit.. Any way I always used to do that, just seen Colin's code and got doubt again...
|
|
|
|
|
N a v a n e e t h wrote: But I read some where like exposing class variables through properties is a bad habit
Actually, it is a very good habit. You may, presently, wish to allow direct access to the variables because the class doesn't care what outside entities set on the variable. But if you do that and then realise that in fact you need to fire off an event, or check the validity of the value then you can't do anything about it.
Properties are methods in reality. A property called Address will actually compile to get_Address() and set_Address(string value). So, by using properties now, even although you may not strictly need them now, saves problems later when you make the field private. You can easily add code to the method (that backs the property) because the public interface has not changed. It isn't so easy moving from public field to public property because they are not the same thing. (Even although in C# the look like the same thing)
Two blog entries of mine that might be of interest:
* Why make fields in a class private, why not just make them public?[^]
* The public fields debate again[^]
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Thanks that was excellent
|
|
|
|
|
N a v a n e e t h wrote: I heard writing properties inside class as a bad habit ? What do you say ?
Good grief no. public fields (aka member variables) are a bad habit.
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
Variables can be declared as Global in the configuration file.
|
|
|
|
|
help me with coding
Mohan
|
|
|
|
|
1)open an connection
2)pass your querry or stored procdure.
3)check if any value is returned
4) redirect to next page
|
|
|
|
|
thanks let me try it once
Mohan B
|
|
|
|
|
|
hi
I need a watermark imaging source code in asp.net 2.0 csharp to create watermarks on images at runtime there is a watermark creator available on codeproject but that is asp.net 1.0 Can some body help please
regards
Harry
|
|
|
|
|
Try to google dear it seasily available on soem forum.
Hello Forum
Always be in touch to help about the topic ASP.NET
|
|
|
|
|
hi
thanks for the help i did try google but was not able to find anything useful can you send me the link if you have one
thanks
harry
|
|
|
|
|
Dear Every one i am new in Dot Net i want to add different banner in header and footer using one admin section my program in asp.net and C#
Any body here to guide me in this situation
Rakesh
-- modified at 3:25 Thursday 9th August, 2007
|
|
|
|
|
I'm having DropDown list in aspx page. When I select the Drop down list,it will go to the Html page, after that it ill display it in a iframe text which is in a aspx page, after doing some edit, the edited text will be stored in a data base.
How to do that? Give me any example.
Thanks in advance
|
|
|
|
|
Hi,
I want to copy the data in a csv to sqlserver 2005 database.
Please help me in this regard.
Data in csv is in this format:
"1","Sa","New Aol","America,NY",""
Please reply asap..
Thanks a lot!!
SHWETA!!
SHWETA!!
|
|
|
|