CodeVerge.Net Beta


   Explore    Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums

ASP.NET Web Hosting – 3 Months Free!



Zone: > NEWSGROUP > Asp.Net Forum > migration_to_asp.net.migrating_from_cold_fusion_to_asp.net Tags:
Item Type: NewsGroup Date Entered: 8/8/2003 3:22:26 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
(NR, 0)
XPoints: N/A Replies: 11 Views: 21 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
12 Items, 1 Pages 1 |< << Go >> >|
rwozniak
Asp.Net User
To if, or not to if8/8/2003 3:22:26 AM

0/0

I'm about to convert an app written in ColdFusion to ASP.NET. The CF code consists of many pages with 'if' statements sprinkled throughout the HTML code. For a simple example, say that a page had 3 dropdowns (each populated via a db query) and a submit button. User A's privileges allow him to see all 3, while user B's allow him to only see the first 2, and user C can only see the first one.

I see two ways to deal w/ this:

Leave it as is. The disadvantages being:

1) The .aspx page is littered w/ if statements.
2) Not a good separation of business logic and presentation code.
3) Since the user's privileges affect whether or not each db query is run, 'if' statements must exist in the code behind page (to determine whether or not to run each query), and also in the .aspx page (to determine whether or not to output the HTML for each dropdown). Very difficult to maintain, and error prown.
4) Since the 'if' statements are nested, and indentation is used for each level of nesting, the HTML will be very hard to follow. Too easy to miss end tags, and it's a nightmare to follow the source sent to the browser.

Set the visibility of each dropdown to false, and in the code behind page, set only the ones that the user should see to true. The disadvantages being:

1) A lot more HTML may be sent to the browser than is actually displayed, slowing down the page load. The above example was overly simplistic...in actuality, the pages are very complex, with huge chunks of HTML that may or may not be presented to the user.
2) A user could theoretically save the HTML source from their browser, and set every non visible element to visible. This allows them to see what they're missing (which may or may not be any big deal).

Perhaps there's another way to approach this. I'm certainly open to suggestions!

Thanks,
Ross
tinypond
Asp.Net User
Re: To if, or not to if8/8/2003 5:01:06 AM

0/0

Seperate the presentation layer, Busiess login layer, Data Access layer and your code will certainly be clearner and easier to support. seems to me that you could pass the userid as a parameter and return the results for all three dropdown from a single procedure. This would produce a less chatty- connect/disconnect connect/disconnect .... application . Then traverse through your dataset and assign the recordset to each drop down.

It all come down to this its trade off you have to decide if you already have it done in ColdFusion why do you want to convert/port your code directly over. Look at the design and think in a more .net way of here is how I can provide functionalty that would have been impossible in coldfusion and I can do in less than 1/2 day in .net.

Hopefully you get the drift here. Your on the right track.

Regard

Tiny



TinyPond
autofed
Asp.Net User
Re: To if, or not to if8/8/2003 8:02:23 AM

0/0

While there are some disadvantages to your second option, the two you list are NOT true. Setting the visiblity of an object to false on the server side causes the object to NOT be rendered to the browser at all. So neither of those issues will be a problem. The second option is definitely the best; its only real downside is the time it will take to do the conversion.

AutoFed
rwozniak
Asp.Net User
Re: To if, or not to if8/8/2003 11:31:52 AM

0/0

Good point. I was thinking that the size of the file being passed over the wire could be much larger than it needs to be in the case of a user w/ limited privileges, but I guess the bulk of the time is in the browser's rendering of the file, not the transfer itself.

I'm actually new to stored procs, and didn't realize that I could not only perform 3 separate selects in a single call, but also only run them conditionally. In other words, User A's page would require that all 3 be run, User A's would only require 2 of them, etc.

Do you know where I could find an example of how to do this?

Thanks,
Ross
tinypond
Asp.Net User
Re: To if, or not to if8/10/2003 4:22:53 AM

0/0

What Database are you working with?

Regards

Tiny
TinyPond
rwozniak
Asp.Net User
Re: To if, or not to if8/10/2003 1:35:54 PM

0/0

SQL Server.
tinypond
Asp.Net User
Re: To if, or not to if8/11/2003 6:54:19 PM

0/0

Download the Starter Kits I would look at the Ibuyspy module I know it has some examples that will help.

Best of Luck


Tiny
TinyPond
ohbajesus
Asp.Net User
Re: To if, or not to if8/12/2003 4:22:57 AM

0/0

You may also want to check the books online located in SQL Server. Search for Create Procedure. Pass the user's credentials as a parameter to the stored procedure and structure the stored procedure using deterministic code to evaluate the parameter(s) passed.


OH gobbledy gook.

Provided You havn't removed the northwind database you can run this in the query analyzer.
It's directly from books online in SQL Server so all props to MSFT.

Books online is a great source of help by the way. :)

USE pubs
IF EXISTS (SELECT name FROM sysobjects
WHERE name = 'au_info' AND type = 'P')
DROP PROCEDURE au_info
GO
USE pubs
GO
CREATE PROCEDURE au_info
@lastname varchar(40),
@firstname varchar(20)
AS
SELECT au_lname, au_fname, title, pub_name
FROM authors a INNER JOIN titleauthor ta
ON a.au_id = ta.au_id INNER JOIN titles t
ON t.title_id = ta.title_id INNER JOIN publishers p
ON t.pub_id = p.pub_id
WHERE au_fname = @firstname
AND au_lname = @lastname
GO

The au_info stored procedure can be executed in these ways:

EXECUTE au_info 'Dull', 'Ann'
-- Or
EXECUTE au_info @lastname = 'Dull', @firstname = 'Ann'
-- Or
EXECUTE au_info @firstname = 'Ann', @lastname = 'Dull'
-- Or
EXEC au_info 'Dull', 'Ann'
-- Or
EXEC au_info @lastname = 'Dull', @firstname = 'Ann'
-- Or
EXEC au_info @firstname = 'Ann', @lastname = 'Dull'

rwozniak
Asp.Net User
Re: To if, or not to if8/12/2003 10:33:44 AM

0/0

I was actually wondering how to execute multiple select statements in a single proc, loading the results of each into a single dataset. Every example I've seen so far shows a single select filling a single datatable.
tinypond
Asp.Net User
Re: To if, or not to if8/13/2003 1:20:08 AM

0/0

Dim cmd As SqlCommand
Dim rdr As SqlDataReader

cmd = New SqlCommand("SELECT * From Fish;" & _
"SELECT * From Food;", _
nwindConn)
rdr = cmd.ExecuteReader()
conn.Open()
rdr.NextResult
Do While myReader.Read()
' Fish records processing?
Loop
rdr.Close()






Note Look up NextResult within Ado. You really should consider stored proc's and returning multiple resultset.

I like to keep reusable and not so specific so I usually don't then to combine mutilple results within a single call




Regard

-Tiny :-)
TinyPond
ohbajesus
Asp.Net User
Re: To if, or not to if8/13/2003 4:58:04 AM

0/0

Simple , perform two selects in the stored proc. i.e.

SELECT * FROM Customers

SELECT * FROM Orders

This will return two recordsets from the stored proc.

I must agree however that, unless there is an absolute need for it, you are better off making two calls to the database from the server rather than passing both recordsets in the Stored Procedure.

Especially since this is a C# web app were talking about.
tinypond
Asp.Net User
Re: To if, or not to if8/13/2003 9:44:41 PM

0/0

The Language really does not matter here the main principle is that it is a webapplication.

TinyPond
12 Items, 1 Pages 1 |< << Go >> >|


Free Download:

Books:
Why You're Still Single: Things Your Friends Would Tell You If You Promised Not to Get Mad Authors: Evan Marc Katz, Linda Holmes, Pages: 158, Published: 2006
If Not Now, When? Authors: Primo Levi, William Weaver, Pages: 349, Published: 1995
If It's Not about Me, I'm Busy: Pearl's Guide to Living Large and Having a Stunning Shoe Wardrobe Authors: Eric Scott, Pages: 64, Published: 2005
I'm, Like, So Fat!: Helping Your Teen Make Healthy Choices about Eating and Exercise in a Weight-Obsessed World Authors: Dianne Neumark-Sztainer, Pages: 317, Published: 2005
It's Not Funny If I Have to Explain It: A Dilbert Treasury Authors: Scott Adams, Pages: 240, Published: 2004
If Not Now when: Reclaiming Ourselves at Midlife Authors: Stephanie Marston, Pages: 288, Published: 2002
Hissy Fit Authors: Mary Kay Andrews, Pages: 419, Published: 2004

Web:
Egypt risks unrest if poor not protected » Kuwait Times Website Nov 23, 2008 ... The world economic crisis could lead to a repeat of the unrest that broke out in Egypt earlier this year if the government fails to cushion ...
Media Matters - O'Reilly "not sure" if Palin wants to overturn Roe ... Sep 19, 2008 ... On his Fox News program, Bill O'Reilly stated that he is "not sure" whether Gov. Sarah Palin "wants to overturn Roe v. Wade .
Amazon.com: If It's Not Close, They Can't Cheat: Crushing the ... Amazon.com: If It's Not Close, They Can't Cheat: Crushing the Democrats in Every Election and Why Your Life Depends on It: Hugh Hewitt: Books.
One's need for loneliness is not satisfied if one sits at a table ... My grandpa's apartment One day I'll find relief I'll be arrived And I'll be friend to my friends who know how to be friends One day I'll be at peace I'll be ...
Lumpectomy not advised if breast cancer returns | Health | Reuters Oct 20, 2008 ... NEW YORK (Reuters Health) - A mastectomy is prudent when breast cancer returns after a lumpectomy, because survival rates are better than ...
Charles Barkley Unleashed: It's Not Gambling If You're Drunk Nov 18, 2008 ... newVideoPlayer Barkley Horse flv The Deadspin Morning Video Wake Up Call will return for a brief period of time from.
Rockstar 'Not Sure' if GTA4 DLC will Release this Year Nov 10, 2008 ... Rockstar 'Not Sure' if GTA4 DLC will Release this Year, Co-founder Dan Houser explains much of their DLC plans haven't been decided yet.
Don't Mess With Taxes: Credit, not cash, if rebate deadline missed Nov 24, 2008 ... The hubby and I got back home last night from a three-day weekend trip to find our economic stimulus payment had arrived.
Pro Applications: Some features do not work if drag installed or ... Sep 24, 2008 ... Pro Applications: Some features do not work if drag installed or if copied following an Archive and Install. Last Modified: September 24, ...
YouTube - Daniel Bedingfield - If You're Not The One: US Video Music video by Daniel Bedingfield performing If You're Not The One: US Videowith Mark Taylor [Producer](C) 2002 Polydor Ltd. (UK)

Videos:
Daniel Bedingfield - If You're Not The One: US Video Music video by Daniel Bedingfield performing If You're Not The One: US Video with Mark Taylor [Producer] (C) 2002 Polydor Ltd. (UK)
Dandy Warhols - Not If You Were The Last Junkie On Earth HQ Heroine is so passe
Shania Twain- If you're not in it for love Shania Rocks!
Shayne Ward - If your not the one this is Shayne Ward singing week 2 of the X-Factor
Daniel Bedingfield - If you're not the one (US version) http://ubedingfield.starszz.com
If your not the one - daniel bedingfield original video of daniel bedingfield
If Not For You - Dylan/Harrison Duet An outtake from the Concert for Bangla Desh, with George Harrison and Bob Dylan singing Dylan's 1970 song "If Not For You."
George Harrison - If not for you- Live 1992 George Harrison only live perfomance of the song at the Bob Dylan Tribute concert held at the Madison Square Garden in 1992.
Tracy Chapman - If Not Now (acoustic) recorded at the second annual bridge school benefit concert - dec. 4, 1988 for information on how to support the bridge school visit their ...
If You're Not the One Just a Great Video With Whole Lot of Meaning...




Search This Site:










cfc in asp.net

asp vs cf

changing coldfusion queries to store procedures

asp to clear cache?

decrypting passwords encrypted using cold fusion encrypt

asp.net migration

cfif tag?

incredible no help or support for basic things like posting a value to another page

asp.net vs coldfusion

tips n tricks

<cfquery> vs. asp.net

newb coming from cf

coldfusion to asp.net automatic conversion tool.

how to cfoutput in asp.net ???

how do you do query of queries (qoq) with asp.net/ado.net?

cfm variable to asp variable

getting inforamtion from coldfusion pages in asp.net page

functions in coldfusion and asp.net

md5 algorithim is different when i use in vb.net, then it is used in cold fusion

logic separate from presentation

asp.net driving me nuts

from cold fusion to...c# or vb...?

cf and .net framework side by side?

questions on coldfusion

migrating from coldfusion to asp.net

converting from coldfusion to asp.net newbie questions

<cfoutput> group attribute

using asp.net on a coldfusion hosted server

to if, or not to if

is it possible to duplicate cf schedule in asp.net?

  Privacy | Contact Us
All Times Are GMT