473,757 Members | 2,081 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Style/Approach Question

CJM
I'm converting a simple query/reporting page from ASP to ASP.NET as a
learning tool. A search box is presented to the user where they enter an ID
number to search for. The page posts back to itself, and a results table is
displayed showing the record requested - pretty simple stuff.

From what I can see so far, there are a number of ways of tackling this, and
probably a few that I dont know of yet(!). In ASP, the first thing I did was
determine whether the page had just been called or whether the form had been
submitted and results where needed. The program flow basically split the
page in two: If form submitted, show results, Else show initial page...

I could presumably follow the same approach in .NET, but I can see that a
number of alternatives are available. I could place the result table with
empty fields in the form from the start but hide it until the right time,
where the codebehind page would populate the table cell values... I could
place an empty table in the form (a placeholder effectively), and
dynamically add row & cells from the codebehind page... Or could dynamically
create both pages from scratch from the code...

I'm sure there are other alternatives asl well. Being fairly new to this,
it's hard to figure what the best approach is. I dont want my ASP background
to influence my design - I'd like to learn the best practices for .NET, and
I'm trying to cut out much of the inevitable trial & error that comes with
starting out. Most of the books & tutorials I have access to are rather
symplistic and rarely are demonstrations of good practice!

So given this scenario, what are the best approaches that you can recommend?
I realise much of this will be influenced by personal style & preferences.

Thanks in advance...

Chris
Nov 18 '05 #1
2 1077
The reason that there are so many ways of doing things is that there are
many types of web applications. How one is structured depends a great deal
upon the requirements. The best advice I can give you is to become familiar
with all of the aspects/components of ASP.Net, and design your app using the
most appropriate methods for fulfilling your app's requirements.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"CJM" <cj*******@news groups.nospam> wrote in message
news:Os******** ******@tk2msftn gp13.phx.gbl...
I'm converting a simple query/reporting page from ASP to ASP.NET as a
learning tool. A search box is presented to the user where they enter an ID number to search for. The page posts back to itself, and a results table is displayed showing the record requested - pretty simple stuff.

From what I can see so far, there are a number of ways of tackling this, and probably a few that I dont know of yet(!). In ASP, the first thing I did was determine whether the page had just been called or whether the form had been submitted and results where needed. The program flow basically split the
page in two: If form submitted, show results, Else show initial page...

I could presumably follow the same approach in .NET, but I can see that a
number of alternatives are available. I could place the result table with
empty fields in the form from the start but hide it until the right time,
where the codebehind page would populate the table cell values... I could
place an empty table in the form (a placeholder effectively), and
dynamically add row & cells from the codebehind page... Or could dynamically create both pages from scratch from the code...

I'm sure there are other alternatives asl well. Being fairly new to this,
it's hard to figure what the best approach is. I dont want my ASP background to influence my design - I'd like to learn the best practices for .NET, and I'm trying to cut out much of the inevitable trial & error that comes with
starting out. Most of the books & tutorials I have access to are rather
symplistic and rarely are demonstrations of good practice!

So given this scenario, what are the best approaches that you can recommend? I realise much of this will be influenced by personal style & preferences.

Thanks in advance...

Chris

Nov 18 '05 #2
Hi Chris,

As for the best practice in ASP.NET you mentioned, I think as for such a
scenario-----------( get search info and display the search result in
page)------------generally , we can put some entry field controls and then
when user input data and submit the form, retreveing the datas and use a
web control to display the result datas.

And as Kevin has mentioned, in ASP.NET , there are many controls and
component you can use to finish such work. Also, to show the table
control(which display the search result), we also can make it created
dynacmially(aft er submit) or staticaly(hide it first before submit). Here
are some reference discussing on the related topics:

1. ASP.NET provide some good buildin template databound controls which can
help generate data displaying page. Here are some tech article introducing
this:

#Deciding When to Use the DataGrid, DataList or Repeater
http://msdn.microsoft.com/library/de...us/dnaspp/html
/aspnet-whenusedatawebc ontrols.asp

#Creating Custom Columns for the ASP.NET Datagrid
http://msdn.microsoft.com/library/de...us/dnaspp/html
/creatingcustomc olumns.asp

#Creating Custom Columns for the ASP.NET Datagrid
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbconwebformsco ntrolstemplates .asp

2. As for put control on a asp.ne webform, we can add the control at
design-time in aspx page template or dynamically created at runtime. the
following tech articles may help you undertstanding it:

#Web Forms Code Model
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbconintroducti ontowebforms.as p

#HOW TO: Dynamically Create Controls in ASP.NET by Using Visual C# .NET
http://support.microsoft.com/default...b;en-us;317794

#Understanding ASP.NET View State
http://msdn.microsoft.com/library/de...us/dnaspp/html
/viewstate.asp

In addition, there are also many asp.net best practice and migration(from
ASP) reference, you may also have a look:

#ASP.NET Best Practices
http://msdn.microsoft.com/library/de...us/dnaspp/html
/aspnet-jspmig-aspnetbestpract ices.asp

#ASP to ASP.NET Migration Guide
http://msdn.microsoft.com/asp.net/us...g/default.aspx

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Get Preview at ASP.NET whidbey
http://msdn.microsoft.com/asp.net/whidbey/default.aspx

Nov 18 '05 #3

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

Similar topics

2
2719
by: Simon | last post by:
Hi. I don't have a problem per se, I was just wondering if anyone can offer some opinions about the best way to go about creating and disposing of a Singleton class. I have a class (handling DB connections) which I have defined as a singleton, using the following pattern (VB.net code) Private Shared mInstance As clsConnection = Nothing
12
1589
by: Vaibhav | last post by:
I recently heard about 'new-style classes'. I am very sorry if this sounds like a newbie question, but what are they? I checked the Python Manual but did not find anything conclusive. Could someone please enlighten me? Thanks!
2
2178
by: dis | last post by:
The following code introduces a 'generic function pointer' p. When calling the pointed-to function via this p, one has to typecast p towards a pointer to the type of the pointed-to function. My question is how to do this if the pointed-to function is a K&R style declared function, like f. The best I could come up with is a typecast towards a pointer to a function with unspecified number and type of parameters (and appropriate return type),...
3
4808
by: Yolande | last post by:
Hi there, In the document I fount on web sit http://download.microsoft.com/download/1/b/b/1bb6e11f-8e8c-46bf-a2d7-9a16976d4526/NETConnectedLogoTechnicalSpec020904.doc, it says that “To be .NET Connected compliant, a Web services application must use the HTTP transport and the Document/Literal SOAP style. (A document-based service uses an XML Schema to define the format for the request and response of the service. A literal message...
2
8000
by: Erwin Moller | last post by:
Hi group, I have this obscure problem that really needs to be fixed, but I am out of ideas. Because the original script is very big, I'll try to summarize its functionality. Setup: - many form-elements that will 'activate' a part of the form based on the selection made.
4
2234
by: jarek | last post by:
Hi, this is my code: CSSStyleDeclaration.prototype.__defineSetter__('display', displaySetter); function displaySetter(value) { var parent = findParent(document, this); if (parent) {
4
2368
by: Michael | last post by:
Hi, I'm having difficulty finding any previous discussion on this -- I keep finding people either having problems calling os.exec(lepev), or with using python's exec statement. Neither of which I mean here. Just for a moment, let's just take one definition for one of the
5
1675
by: JDS | last post by:
I am trying to figure out how to use Subversion, but this question isn't really Subversion-specific. Any version control system will suffer from the same problem, IMO. I've crossposted to those groups I've deemed most relevant WRT web development. (Well, relevant to *me*). I don't think this question will be completely relevant in a C/C++ or other local devlopment environment. Maybe it is...
12
1481
by: Matt B | last post by:
I was just wondering if there is a "best" choice from the following couple of ways of returning a value from a method: 1) private HashAlgorithm GetSpecificHashAlgorithm(string hashString){ if (hashString == "MD5") { return System.Security.Cryptography.MD5.Create(); } else { return System.Security.Cryptography.SHA512.Create(); }
0
9487
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9297
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10069
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9904
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8736
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6556
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3828
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3395
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.