473,386 Members | 1,830 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Best way to call a class from code behind

Hi,

I have a web apps wherein the registration.aspx has about 7 textbox
(general registration form with username, Fname, Lname, Password,
EmailAddress etc,

now i have to insert these values in the database after the user clicks
on submit.
OnSubmit : i have a user class
clsUser
{
private string Username;
private string Fname,Lname; //etc

public insert_user(string un,string Ln,....)
{
clsUser.Username = un;
......
objDataBase.insertuser(clsUser.Username.....)
}
In code behind i will create an object of clsUser and call the fuction
as

objclsUser.insert_user(textbox1.text, .......);

I dont feel this is the best method, can i use all the vars (username,
Lname....) as properties...in the class clsUser

in short how do i make both the classes lesser dependent on each
other.....

help appreciated....

thnx,
Pushpadant

Jul 4 '06 #1
1 970
If this is .NET 2.0, then generics are probably a good design option.
This article deals with your situation directly.

http://www.eggheadcafe.com/articles/...ion_layers.asp

--
Robbe Morris - 2004-2006 Microsoft MVP C#
Earn money answering .NET questions
http://www.eggheadcafe.com/forums/merit.asp

"Pushpadant" <pu********@gmail.comwrote in message
news:11**********************@v61g2000cwv.googlegr oups.com...
Hi,

I have a web apps wherein the registration.aspx has about 7 textbox
(general registration form with username, Fname, Lname, Password,
EmailAddress etc,

now i have to insert these values in the database after the user clicks
on submit.
OnSubmit : i have a user class
clsUser
{
private string Username;
private string Fname,Lname; //etc

public insert_user(string un,string Ln,....)
{
clsUser.Username = un;
......
objDataBase.insertuser(clsUser.Username.....)
}
In code behind i will create an object of clsUser and call the fuction
as

objclsUser.insert_user(textbox1.text, .......);

I dont feel this is the best method, can i use all the vars (username,
Lname....) as properties...in the class clsUser

in short how do i make both the classes lesser dependent on each
other.....

help appreciated....

thnx,
Pushpadant

Jul 6 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hugh McLaughlin | last post by:
Hello Everyone and thanks for your help in advance. I have read a great deal about code reuse and the development of the three-tier application, but am somewhat confused on some issues and am...
136
by: Matt Kruse | last post by:
http://www.JavascriptToolbox.com/bestpractices/ I started writing this up as a guide for some people who were looking for general tips on how to do things the 'right way' with Javascript. Their...
0
by: Anonieko Ramos | last post by:
ASP.NET Forms Authentication Best Practices Dr. Dobb's Journal February 2004 Protecting user information is critical By Douglas Reilly Douglas is the author of Designing Microsoft ASP.NET...
6
by: grist2mill | last post by:
I want to create a standard tool bar that appears on all pages that is a control. The toolbar has a button 'New'. What I wolud like when the user clicks on 'New' depends on the page they are on. I...
6
by: Nate | last post by:
I am in a slight predicament trying to determine the most efficient and effective way to connect/disconnect from a database within a business object (c# dll). I'm also keeping in mind the concept...
1
by: momo | last post by:
Okay guys, I have this one problem and I admitted I am a novice at this. This is a Code Behind in an aspx page. You will see where I have the plus signs below in SecureQueryString2.vb where I am...
1
by: Rob Meade | last post by:
Hi all, At work one of my colleagues wrote a set of classes that we use in a common class library within our applications. Although I use this on a daily basis I haven't actually looked at his...
9
by: John Salerno | last post by:
Let's pretend I'm creating an Employee class, which I will later subclass for more specific jobs. Each instance will have stuff like a name, title, degrees held, etc. etc. So I'm wondering, is...
41
by: Jim | last post by:
Hi guys, I have an object which represents an "item" in a CMS "component" where an "item" in the most basic form just a field, and a "component" is effectively a table. "item" objects can be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.