You are on page 1of 6

Creating a Quiz Web application using SharePoint designer - Part 1

brenclarke brenclarke 14 Apr 2009 !40 A" 2# $i% &' na&e is (rendan Clarke and ) *ork as a partner technical specialist in SharePoint+ )n this ,i-e part article ) *ill pro-ide a step b' step guide to build a si&ple Quiz *eb application using SharePoint designer+

)t.s per,ectl' possible to build *eb applications *ithout *riting an' custo& code /as the ,abulous ,ort' application te&plates illustrate *ell0 and no* that SharePoint 1esigner is a-ailable as a ,ree do*nload co&bined *ith launch o, SharePoint 2nline /(P2S0 around the *orld it.s possible to deli-er business solutions -er' rapidl'+

$ere3s is a pre-ie* o, the three pages that *ill ,or& our co&pleted application!

4he abo-e picture sho*s the 1e,ault+asp5 page% the Sho*Question+asp5 and the Sho*6esults+asp5 page

2-er-ie*

We &ostl' use the -er' po*er,ul 1ata 7ie* Web Part /17WP0 to build our application and *e *ill co-er so&e great *a's o, &anipulating list data% such as! 8 8 8 8 8 8 8 8 Passing para&eters ,ro& one *eb page to another -ia a 9uer' string Passing -alues ,ro& one *eb part to another 6e&o-ing the /usuall' &andator'0 4itle ,ield ,ro& list ,or&s and -ie*s :sing use,ul s'ste& -ariables /such as the logged in user and current date0 Pre-loading ,or& ,ields *ith -alues Creating a persistent session identi,ier to link &ultiple list ite&s Creating custo& ,or&s and passing &ultiple para&eters in a redirected ,or& "anipulation o, the $4"; presentation using <S;4

4he application uses three custo& lists /Quiz% Questions and Ans*ers0 and three ASP< pages /de,ault% Sho*Question% Sho*6esults0

So% let.s =u&p in and get started+ ) a& assu&ing a general kno*ledge o, SharePoint and SharePoint 1esigner so ) *ill not describe in detail the &ore basic steps+

Create the lists >irstl' create a ne* site /or sub site0 ,or 'our application /a tea& site or blank site te&plate should be ,ine0+ ?ou then need to create three ne* custo& lists either -ia the *eb inter,ace /Site actions @ create @ lists @ Custo& list0 or b' using SharePoint designer />ile A Be* A SharePoint Content A Custo& list0+ 4he three custo& lists ,or the application are! Ba&e o, ;ist :sed ,or :sed b' Quiz Stores details o, the Quiz itsel, /4itle% pass &ark% nu&ber o, 9uestions0 1e,ault+asp5 Questions Stores each 9uestion% its &ultiple choice options and the correct ans*er Sho*Question+asp5 Ans*ers 4he application uses this list to store the ans*er the user chooses Sho*Question+asp5 Sho*6esults+asp5

(elo* are the steps to create the ,ields ,or each list+

Create the Quiz list

?ou *ill alread' ha-e a ,ield created called C4itleC *hich *e *ill store the na&e o, each Quiz% 'ou then need to create the ,ollo*ing additional ,ields in 'our list! >ield Ba&e 4'pe 1escription "ultiple lines o, te5t Pass"ark Bu&ber D also tick the EpercentageF bo5 Bu&ber2,Questions Bu&ber

Create the Questions list

>ield Ba&e 4'pe Quiz ;ookupG ;ink the lookup ,ield to the 4itle o, the Quiz list+ QuesionBu&ber Bu&ber Question "ultiple lines o, te5t D enhanced te5tH Ans*erA

"ultiple lines o, te5t D enhanced te5tH Ans*er( "ultiple lines o, te5t D enhanced te5tH Ans*erC "ultiple lines o, te5t D enhanced te5tH Ans*er1 "ultiple lines o, te5t D enhanced te5tH CorrectAns*er Choice- Add ESelectF% EAF%F(F%FCF and E1F on separate lines /*ithout the 9uotes0 Inter ESelectF as the de,ault -alue+

H(' selecting these ,ields as Eenhanced te5tF *e can include pictures and ad-anced ,or&atting in our 9uestion and ans*er te5t+

A Quick di-ersion! Jetting rid o, the 4itle ,ield ,ro& our ,or&s and -ie*s

As 'ou can see ,ro& the table abo-e% in this instance *e don.t ha-e an' use ,or the 4itle ,ield% *hich is created b' de,ault in e-er' list+ We can edit the >ield na&e /not reco&&end0 and change it so that is doesn.t re9uire an' in,or&ation and also re&o-e it ,ro& the de,ault -ie* but it still sho*s up in our ,or&+ As it.s likel' that other people *ill be creating ne* entries so it *ould be good to re&o-e it ,ro& the ,or& co&pletel' /note! the ,ield *ill still e5ist *hich is a good thing% users =ust *on.t see it0+ $ere is ho* to re&o-e the 4itle ,ield ,ro& our ,or&s and the de,ault -ie*! 4o re&o-e the title ,ield ,ro& our ,or&! 1+ 2+ K+ 4+ Jo to the list and choose Settings A ;ist Settings Click CAd-anced settingsC Change the ,irst entr'% CAllo* &anage&ent o, content t'pesLC to ?es )n the EContent 4'pesF section that has =ust appeared% click the C)te&C link

M+ N+

Click the C4itleC ,ield and select E$idden /*ill not appear on ,or&s0F Change the &anage&ent o, content t'pes back to EBoF /steps 1-20

4o re&o-e the title ,ield ,ro& our list -ie*! 1+ Jo to the de,ault -ie* ,or the list b' clicking the list na&e /the page *ill be OlistsOQuestions+All)te&s+asp50 2+ )n the -ie* selector bo5 click and select "odi,' this -ie*

"odi,' -ie*

1+ 2+

:n-tick the 4itle ,ield in the displa' section 1on.t click 2P 'etQ

"odi,'ing the de,ault -ie* to group and sort our 9uestions

Whist *e are here it *ill be use,ul to &ake the de,ault -ie* o, the Questions ,riendlier+ As *e &a' end up *ith se-eral sets o, 9uestions sho*n in one long list it *ould &ake it hard *ork to &anage+ ;et.s group each set o, Questions into the Quiz the' belong to and also list the 9uestions in the correct order+ 4o do this! 1+ 2+ )n the ESortF section change the E>irst sort b'+++F colu&n to EQuestionBu&berF I5pand the EJroup b'F section and choose to group b' the EQuizF colu&n

4he -ie* *ill no* group each set o, 9uestions correctl'% like this

Create the Ans*ers list

>ield Ba&e 4'pe

4itle Single line o, te5t Ans*erJi-en Choice D Add options ,or A% (% C and 1 CorrectAns*er Single line o, te5t I5a& Single line o, te5t QuestionBu&ber Bu&ber Session)1 Single line o, te5t "arkAns*er Calculated - add the ,ollo*ing ,or&ula!

R)>/Ans*erJi-enRCorrectAns*er%1%00

As 'ou can see% the "arkAns*er uses a -er' si&ple ,or&ula% i, the :ser.s ans*er &atches the ans*er to the 9uestion /stored in the CorrectAns*er ,ield% *hich is passed ,ro& the Question table0 then the ,ield is set to a S1.% other*ise it.s a S0.+ ?ou ha-e no* created all the lists that 'ou need+ (e,ore *e &o-e on it is *orth adding a little data into the Quiz and Questions lists% so that 'ou can &ake sure the' are all *orking oka' and it also gi-es us so&e data to *ork *ith *hen *e create and test our application+ Create at least one Quiz list ite& and then add so&e Questions list ite&s - in the ne5t part *e *ill start to build our ASP< pages *hich *ill *ork *ith the lists 'ou ha-e =ust created+

You might also like