|
| |
| rwozniak | Asp.Net User |
| To if, or not to if | 8/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 |
| rwozniak | Asp.Net User |
| Re: To if, or not to if | 8/10/2003 1:35:54 PM |
0/0 | |
| |
| ohbajesus | Asp.Net User |
| Re: To if, or not to if | 8/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'
|
|
| |
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:
|
|