Properties Versus Parameters

May 21, 2010

you have a class and the class has a function that returns a dataset. If the function requires a few values to return data how do you determine whether you create parameters for the function or create private fields and get and set properties and just call the properties get functions?

Properties option
private x as integer = 0
function getX()
return x
end function
function setX(xValue as integer)
x = xValue
end function.......

View 3 Replies


Similar Messages:

DataBind Versus Setting Control Properties

Nov 9, 2010

Regarding these two approaches:

<asp:Label ID="Label1" runat="server"><%# DateTime.Now %></asp:Label>

and

Label1.Text = DateTime.Now.ToString();

Which do you use and why?

View 2 Replies

Configuration :: Deploying Versus Releasing Versus Implementing

Sep 16, 2010

What is the difference between; Deploying an application Releasing an application Implementing an application

View 1 Replies

Application_Start Versus OnInit Versus Constructor?

Jul 23, 2010

I've gone rounds with this ever since I started programming classic ASP 12 (or so) years ago and I've never found a great solution because the architecture of ASP and ASP.NET has always been a swamp of bad practices, magic shared singletons, etc. My biggest issue is with the HttpApplication object with its non-event events (Application_Start, Application_End, etc.).

If you want to do stuff once for the entire lifespan of an HTTP application, Application_Start is the obvious place to do it. Right? Not exactly. Firstly, this is not an event per se, it's a magic naming convention that, when followed, causes the method to be called once per AppDomain created by IIS.

Besides magic naming conventions being a horrible practice, I've started to think it might be a reason there exist no such thing as a Start event on the HttpApplication object. So I've experimented with events that do exist, such as Init. Well, this isn't really an event either, it's an overridable method, which is the next best thing.

It seems that the Init() method is called for every instantiation of an HttpApplication object, which happens a lot more than once per AppDomain. This means that I might as just put my startup logic inside the HttpApplication object's constructor.

Now my question is, why shouldn't I put my startup logic in the constructor? Why does even Init() exist and do I need to care about Application_Start? If I do, can anyone explain why there is no proper event or overridable method for this pseudo-event in the HttpApplication object?

And can anyone explain to me why in a typical ASP.NET application, 8 instances of my HttpApplication are created (which causes the constructor and Init to run just as many times, of course; this can be mitigated with locking and a shared static boolean called initialized) when my application only has a single AppDomain?

View 2 Replies

Web Forms :: Properties Folder / Properties Changed No Settings Tab?

Nov 3, 2010

I have a new VS2010 .NET 4.0 Web project and the Properties Folder has gone wierd on me. It has lost teh "Open" under the right click. There is no way to get a Settings file created now.

I am unable to get to the Settings grid and no Settings file is created. I tried the help and it has the normal trip of select Properties, Open (right click), Settings Tab, etc. etc.

View 1 Replies

SQL Server :: What If Multiple Output Parameters And Input Parameters And Also Want A Select Table

Feb 16, 2011

[Code]....

When I want to get the output values its okay but I also want returning a table as a result data.But Datareader has no rows.is it possible if I want a returning query result and multiple output values togather ?I wrote a test above.I can get output values as sqlparameters. But Datareader attached to a Gridview is empty.can you detect whats wrong here and it doesnt return a query result.So stored procedure is not standart or ı am doing something wrong.this doesnt raise any exception.but not returning any data.

[code]....

View 8 Replies

How To Define A Route That Have 2 Optional Parameters In The Middle Of The URL The Start An End Parameters Are Digits

Jun 7, 2010

I want to define a route that have 2 optional parameters in the middle of the URL the start an end parameters are digits

[Code].....

View 1 Replies

Best Way To Read Values From Properties File (similar To Rading A Properties File From JSP Or Java)?

Mar 3, 2010

I am relatively new to ASP.NET. I am just wondering if there is way to read values from properties file (similar to rading a properties file from JSP or java).

For example if a property file has something similar to this:

[Code]....

I would like to read all the values for username_list (comma seperated) and also the value of is_valid.

View 2 Replies

MVC :: MVC3 RC2 Bug Binding From Request Parameters To Method Parameters?

Dec 10, 2010

Since ASP.NET MVC3 RC2 I encounter a bug when posting values to a controller method of which one of the parameter is a nullable int. Steps to reproduce:

I've created a test method

[code]....

In MVC3 RC1 this was working without any problems with the nullable int

Update:
I don't seem to have the problem with a newly created MVC3 website. What could I have in my project that influence model binding to nullable int's? And why would there be a difference between RC1 and RC2?

View 10 Replies

How To Get The Individual Parameters From The List Of Dynamic Parameters In A Webmethod

May 12, 2010

I am using jquery ajax method on my aspx page,which will invoke the webmethod in the code behind.Currently the webmethod takes a couple of parameters like firstname,lastname,address etc which I am passing from jquery ajax method using

data:JSON.stringify({fname:firstname,lname:lastname,city:city})

now my requirement has been changed such that,the number and type of parameters that are going to be passed is not fixed for ex.parameter combination can be something like fname,city or fname,city or city,lname or fname,lname,city or something else.So the webmethod should be such that it should accept any number parameters.I thought of using arrays to do so, as described here.

But I do not understand how can I identify which and how many parameters have been passedto the webmethod to insert/update the data to the DB.

View 4 Replies

VB.Net Versus C Sharp

Aug 18, 2010

which is the better language in terms of coding, proficieny if we compare between VB.Net and C Sharp.

View 7 Replies

Winform Versus MVC

Jun 1, 2010

I want to know when to use winform and MVC asp.net

View 11 Replies

SQLDataSource Versus ADO.NET

Mar 8, 2011

If I want to connect to a database in ASP.Net, is it better to use ADO.NET rather than SQLDataSource? They serve a similar purpose, correct?

View 7 Replies

DataSource Controls :: Use Is Null In Query Without Using Parameters For It Or Should Use Parameters For This Field Where Value Is NULL

Jan 21, 2010

here is my code for selectiong some records from db table

string strSql = "select * from mtblNBD where SentTo=@SentTo and InternalStatus Is NULL order by DeadLine desc";
SqlCommand com = new SqlCommand(strSql, con);
com.Parameters.Add("@SentTo", SqlDbType.NVarChar, 50).Value = (string)Session["uname"];

here I am using parameters for SenTo field but not for NULL so it is ok... or should I use parameters for this field where value is NULL , if yes then how can I use parameter for this

View 8 Replies

Website Versus Web Application

Mar 29, 2010

I am using VS 2008/VB.Net and am trying to figure out if I should use a "Website" or a "ASP.Net Application" project type.

I have to create an online tool to allow users to manage data, there should be no more than 5-10 users at a time on the system. I need to use Profile/Membership with the tool.

I plan to use the <correction> N-layer </correction> (not "n-tier") architecture with a Business layer and DB layer.

I am wondering about the advantages/disadvantages of each.

Is the "website" model really outdated? I notice that the Website model has in built support for many more namespaces but with asp.net application does not, you have to add a lot of references.

View 5 Replies

CSS Versus Master Page

Jul 31, 2010

my application uses a master page from which every other page inherits and also an external style sheet.

the problem i have is that once a messagebox pops up while running the application(maybe due to an error that was caught) the "content" part of the page loses the styles that were applied to them from the external style sheet. Only the Master page part of the page still retains the external styles.

assistance, will be very welcome.

Incase this might be useful too: i use the Response.Write method to call the javascript "alert" function to display pop ups.

View 2 Replies

ViewModels Versus Presentations, Or Both?

Apr 28, 2010

Previously to learning about ViewModels and AutoMapper, my infrastructure project had the following classes defined:

Csharp Code:

[code]....

View 2 Replies

MVC Versus Ruby On Rails

Nov 30, 2010

If you were starting a new web development project would you use ASP.Net MVC 2 or Ruby on Rails?

I have recently invested some time in to learning Ruby on Rails because I wanted to learn a solid web development framework. Then I took a new job where I will be using ASP.Net MVC 2.

I know this question is very subjective, but I am planning to write some websites on my own, outside of work, and I would like to get some opinions from others.

View 4 Replies

SqlDataSource Versus ADO.NET Coding With C#

Feb 25, 2011

I really do not have time to learn new language, in my case asp.net, but would like to start developing website in asp.net. I do not want to use asp:SqlDataSource control. is it ok if i write in codebehind aspx: all database connections and other CRUD operations in ado.net and c#. I already know xhtml, javascript - jquery, css, xml, json, some knowledge in sever-side coding (before php). want to start coding, instead of learning messy asp.net controls.I have to sit and learn all bloody ways of using those asp.net controls?

View 2 Replies

C# - Umbraco Versus Sitefinity

Oct 19, 2010

I am getting a large website developed. The develop has asked me which do I prefer either sitefinity or umbraco. The site will be similar to wikipedia where users can come and edit pages without having to login. I would like to ask your opionions on these two csm systems and which one would you recommend for content website with a community feel and wiki features.

View 5 Replies

Python Django Versus MVC

May 21, 2010

break up the pros and cons of using python django vs asp.net mvc besides the maturity level of its framework. I have intermediate experience with JAVA. As of right now, i'm leaning towards python but i just wanted to make sure i am making the right choice.

I find myself limited with books available on asp.net web developments. I am aware that there is the storefront example on the official asp.net site. However, that tutorial was a little hard for me to follow. I've done a research around and was python could be my next available choice. There are more tutorials available online for python anyways.

View 1 Replies

Using LINQ Contains Versus SqlMethods.Like?

Jan 29, 2010

How do I replicate the following result in my LINQ query without calling in the helper library System.data.Linq.SqlClient?

Where SqlMethods.Like(e.POSITION, "%A[FGL]7%") _

I would like this query to be more purely LINQ if possible.

View 3 Replies

Advantage Of Themes Versus CSS?

Jan 24, 2010

Since Themes in ASP.NET are used to style elements of your site, I was just wondering why would you use Themes rather than CSS, or is it common practice to use both? If so, when would you opt for one versus the other and why?

Just seems to me like Themes are kind of unnecessary, so I am just looking on clarification if there really is a good reason to use them, or it's just a part of the framework as an alternative(unnecessary) step to styling your site.

View 2 Replies

Running The Project Versus Viewing In IIS

Nov 19, 2010

This could be a simple one but it has got me baffled. I have a ASP.NET solution that I have stored in C/inetpub/www/root/website. The solution and project files are all stored in there and I have set it up as a virtual directory in IIS.so I can view the web page in 2 ways.

1. - By running the solution [URL]

2. - By viewing the url in IE: [URL]

I changed the project to use windows authentication and I added alabel in the top right of the page which displays the user logged in i.e. DOMAINusername.

When I run the solution from VS2008 it displays the username on the page no problem (that is my logon id since I am running it). But when I view the page by typing the URL into IE - it doesnt seem to recognise the authentication and it doesnt display my DOMAINusername in the label.

Any ideas why this is? I thought maybe it was something to do with the .dlls but I did a simple test. In the project I created a new a label on the page and in the page_load I wrote "label.text = "Test Text". In both cases the label showed "Test Text" as expected so it is nothing to do with building the solution. Is there something about windows authentication - why would it work in one case and not in the other? So as a third test I actually opened IIS and right-clicked on the my website in the console and choose "browse".

I then got the following error:

Sequence contains no elements

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.InvalidOperationException: Sequence contains no elements

Source Error:

[Code]....

Now I set a break point at this point in my project in VS2008 - but when I run it there it doesnt even go to this code!

View 3 Replies

String Builder Versus Repeater (which Is Best)

Jun 29, 2010

I have written such a code to loop through the records and build a string.

Is this s good idea or should I use repeater or something?

[code]....

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved