updateanMP.aspxReturn to the Documentation page
  

functionsloadData
linkToMainMenu
clearControls
onBtnClearClicked
updateMPs

<%@ Page Language="vb" %>

<%@ import Namespace="System.Data" %>

<%@ import Namespace="System.Data.ODBC" %>

<script runat="server">

‘The loadData function runs when the user clicks the ‘Load Constituency’s details’ button. It pushes all the data for that constituency into the textboxes of the web form below.’

‘Declare a string variable [changedConstituency] which will be used by the Access2000 variable further down. It may be needed because some of the constituencies contain an apostrophe e.g. Regent's Park & Kensington North. The apostrophe needs to be dealt with using the InStr function as shown below, because it may cause an error when trying to retrieve data from the Access 2000 database.’

dim changedConstituency as String

‘Checks to see if the user has entered a constituency into the textbox named txtConstituency1. Does nothing if the box is blank - see the last Else statement below in this function.’

If txtConstituency1.Text <> "" then

‘If the contents of the textbox [txtConstituency1] include an apostrophe 's' then...’

if Instr(txtConstituency1.Text, "'s") <> 0 then

‘Use the Replace method to add another single quote to it i.e. "''s". This will enable the code below to retrieve the record from the Access2000 database and display it in the web form.’

changedConstituency = Replace(txtConstituency1.Text, "'s", "''s")

‘Otherwise, if there is no such character within the string representing the constituency...’

else

‘Put the contents of the textbox [txtConstituency1] into the string variable - changedConstituency.’

changedConstituency = txtConstituency1.Text

‘Ends the IF...THEN...ELSE...END IF block.’

end if

‘Declare variables and define the connection string [strConn], the query string [Access2000], the ODBCDataAdapter object [Cmd]and a dataset [ds] to hold the results of the query.’

Dim Access2000 as string = "select * from fullresults WHERE constituency='" & changedConstituency & "'"

Dim MyConn as New ODBCConnection(ConfigurationSettings.AppSettings("strConn"))

Dim Cmd as New ODBCDataAdapter(Access2000,MyConn)

Dim ds as DataSet=New DataSet()

‘The fill method of the ODBCDataAdapter object puts the data into the dataset and into a table named mps.’

Cmd.Fill(ds,"mps")

‘Declare a variable [dTable] of type DataTable and assign it to the ‘mps’ table.’

dim dTable as DataTable = ds.Tables("mps")

‘If there is at least one record/row in the table then….’

If dTable.Rows.Count > 0

‘Declare an array [CurrRows()] of type DataRow and assign it to the record in the ‘mps’ table – there should be one record if the constituency entered is a valid constituency. If the constituency isn’t valid then an error message is displayed in the Label3 asp label – see below.’

Dim CurrRows() as DataRow = dTable.Select(Nothing, Nothing, DataViewRowState.CurrentRows)

‘Declare an array [Boxes()] of type TextBox and assign values as indicated - the ids of all the textboxes within the ASP table control [table1]. This will be used in the FOR...NEXT loop below.’

Dim Boxes() as TextBox = { txtCountry, txtConstituency, txtRegion, txtFirstParty, txtFirst, txtFirstVotes, txtSecondParty, txtSecond, txtSecondVotes, txtThirdParty, txtThird, txtThirdVotes, txtFourthParty, txtFourth, txtFourthVotes, txtFifthParty, txtFifth, txtFifthVotes, txtSixthParty, txtSixth, txtSixthVotes, txtSeventhParty, txtSeventh, txtSeventhVotes, txtEighthParty, txtEighth, txtEighthVotes, txtNinthParty, txtNinth, txtNinthVotes, txtTenthParty, txtTenth, txtTenthVotes, txtEleventhParty, txtEleventh, txtEleventhVotes, txtTwelfthParty, txtTwelfth, txtTwelfthVotes, txtThirteenthParty, txtThirteenth, txtThirteenthVotes, txtFourteenthParty, txtFourteenth, txtFourteenthVotes, txtFifteenthParty, txtFifteenth, txtFifteenthVotes, txtSixteenthParty, txtSixteenth, txtSixteenthVotes, txtTurnout, txtSwing, txtSwingtoparty, txtResult, txtWinningparty, txtNotes }

‘Declare a variable [i] of type integer.’

dim i as integer

‘Start a FOR loop with i initally set to 0. The loop will continue until i reaches the last value in the array Boxes - this index is retrieved using the GetUpperBound method.’

for i = 0 to Boxes.GetUpperBound(0)

‘Assign the data from the DataRow object into the textboxes on the web form – e.g. when i=0: the first loop will assign txtCountry.Text = CurrRows(0) (0).ToString and so on through the array of textboxes, finishing off with txtNotes.Text = CurrRows(0) (56).ToString.’

Boxes(i).Text = CurrRows(0)(i).ToString

‘Starts an IF...THEN...ELSE...END IF loop which checks to see if the contents of the Region textbox [Boxes(2)] are equal to 'Merseyside & Gr. Manchester'.’

if Boxes(2).Text = "Merseyside & Gr. Manchester" then

‘If it is then make the font-size only 9pts so that it will display correctly.’

Boxes(2).Attributes.Add("style", "font-size: 9pt")

‘But if it isn't....’

else

‘Make the font-size 10pts.’

Boxes(2).Attributes.Add("style", "font-size: 10pt")

‘Ends the IF...THEN...ELSE...END IF loop.’

end if

‘Increments the integer i by 1 and returns to the top of the FOR...NEXT loop.’

next

ELSE

‘If the constituency entered isn’t found in the table [fullresults] then an error message is displayed in the label [Label3] underneath the textbox [txtConstituency1].’

Label3.Text = "Sorry, there is no data for that constituency."

 

END IF

‘Tidy up and close the connection object.’

cmd.Dispose

MyConn.Close

‘If there is no text inside the textbox [txtConstituency1] when the user clicks the button [btnLoad] then nothing happens and the function ends.’

ELSE

END IF

‘Redirects the user back to the main menu using an asp Linkbutton web control. This can be found in the top right-hand corner of each page.’

Response.Redirect("mainmenu.aspx")

‘The clearControls function runs when the user clicks the ‘Clear’ button on the web page. It is called from the OnBtnClearClicked() function which is documented below. It clears all the data from the textboxes and labels on the form.’

‘Starts a FOR EACH...NEXT loop that looks at the type of web server control on the web form.’

for each ctrl As Control in Controls

‘If the control is a textbox then set its text property to "". Note the control has to be first cast as a textbox using the CType function before its text property can be set.’

If TypeOf ctrl Is TextBox then CType(ctrl,TextBox).Text = ""

‘If the control is a label AND its ID is label3 then set its text property to "". As before, the control has to be first cast as a label using the CType function before its text property can be set to 'empty'.’

if TypeOf ctrl Is Label AND (ctrl.ID = "Label3") then CType(ctrl, Label).Text = ""

‘Check to see if the control has any child controls within it using the HasControls method. If it has run the clearControls function over them as well and clear the textboxes and labels of any text.’

if ctrl.HasControls then clearControls(ctrl.Controls)

next

‘Return to the calling function which is the OnBtnClearClicked() subroutine below.’

return

‘When the user clicks the ‘Clear’ button at the bottom of the form all the textboxes are emptied of text.’

‘Calls the clearControls function with all the controls on the page as a parameter. This function is described above.’

clearControls(Page.Controls)

‘Sets the cssClass of the ASP table [table1] to the normal style.’

table1.cssClass = "normal"

‘When the user clicks the ‘Update result’ button at the bottom of the form the amended data is written to the fullresults table of the Access2000 database - election2001.mdb.’

‘Declare an ODBCConnection object [MyConn] using the strConn variable as a parameter which is fetched from the web.config file.’

Dim MyConn as New ODBCConnection(ConfigurationSettings.AppSettings("strConn"))

‘Declare a string variable [Access2000] which is set to a complicated SQL statement – UPDATE…. SET…. Each textbox’s Text property is assigned to the relevant field in the fullresults table i.e. country='" & txtCountry.Text & "'. The first three places of each constituency are fairly straightforward – however the fourth, fifth and remaining places are not because it is possible that there could be no candidates for these places e.g. fourthparty=?’

dim Access2000 as String = "UPDATE fullresults SET country='" & txtCountry.Text & "', region='" & txtRegion.Text & "', constituency='" & txtConstituency.Text & "', firstparty='" & txtFirstparty.Text & "', first='" & txtFirst.Text & "', firstvotes='" & txtFirstvotes.Text & "', secondparty='" & txtSecondparty.Text & "', second='" & txtSecond.Text & "', secondvotes='" & txtSecondvotes.Text & "', thirdparty='" & txtThirdparty.Text & "', third='" & txtThird.Text & "', thirdvotes='" & txtThirdvotes.Text & "', fourthparty=?, fourth=?, fourthvotes=?, fifthparty=?, fifth=?, fifthvotes=?, sixthparty=?, sixth=?, sixthvotes=?, seventhparty=?, seventh=?, seventhvotes=?, eighthparty=?, eighth=?, eighthvotes=?, ninthparty=?, ninth=?, ninthvotes=?, tenthparty=?, tenth=?, tenthvotes=?, eleventhparty=?, eleventh=?, eleventhvotes=?, twelfthparty=?, twelfth=?, twelfthvotes=?, thirteenthparty=?, thirteenth=?, thirteenthvotes=?, fourteenthparty=?, fourteenth=?, fourteenthvotes=?, fifteenthparty=?, fifteenth=?, fifteenthvotes=?, sixteenthparty=?, sixteenth=?, sixteenthvotes=?, turnout='" & txtTurnout.Text & "', swing=?, swingtoparty=?, winningparty='" & txtWinningparty.Text & "', result='" & txtResult.Text & "', notes=? WHERE constituency='" & txtConstituency1.Text & "'"

‘Declare an ODBCCommand object [cmd] which takes the above Access2000 variable and the MyConn connection object as parameters.’

dim cmd as new ODBCCommand (Access2000, MyConn)

‘Declare an array of type ODBCParameter [Params] and specify the values as shown. These parameters will deal with the problem of blank fields in the database. Some constituencies will only have three candidates whilst others will have a lot more - see below.’

Dim Params() As OdbcParameter = { New OdbcParameter("@Fourthparty", txtFourthparty.Text), New OdbcParameter("@Fourth", txtFourth.Text), New OdbcParameter("@Fourthvotes", txtFourthvotes.Text), New OdbcParameter("@Fifthparty", txtFifthparty.Text), New OdbcParameter("@Fifth", txtFifth.Text), New OdbcParameter("@Fifthvotes", txtFifthvotes.Text), New OdbcParameter("@Sixthparty", txtSixthparty.Text), New OdbcParameter("@Sixth", txtSixth.Text), New OdbcParameter("@Sixthvotes", txtSixthvotes.Text), New OdbcParameter("@Seventhparty", txtSeventhparty.Text), New OdbcParameter("@Seventh", txtSeventh.Text), New OdbcParameter("@Seventhvotes", txtSeventhvotes.Text), New OdbcParameter("@Eighthparty", txtEighthparty.Text), New OdbcParameter("@Eighth", txtEighth.Text), New OdbcParameter("@Eighthvotes", txtEighthvotes.Text), New OdbcParameter("@Ninthparty", txtNinthparty.Text), New OdbcParameter("@Ninth", txtNinth.Text), New OdbcParameter("@Ninthvotes", txtNinthvotes.Text), New OdbcParameter("@Tenthparty", txtTenthparty.Text), New OdbcParameter("@Tenth", txtTenth.Text), New OdbcParameter("@Tenthvotes", txtTenthvotes.Text), New OdbcParameter("@Eleventhparty", txtEleventhparty.Text), New OdbcParameter("@Eleventh", txtEleventh.Text), New OdbcParameter("@Eleventhvotes", txtEleventhvotes.Text), New OdbcParameter("@Twelfthparty", txtTwelfthparty.Text), New OdbcParameter("@Twelfth", txtTwelfth.Text), New OdbcParameter("@Twelfthvotes", txtTwelfthvotes.Text), New OdbcParameter("@Thirteenthparty", txtThirteenthparty.Text), New OdbcParameter("@Thirteenth", txtThirteenth.Text), New OdbcParameter("@Thirteenthvotes", txtThirteenthvotes.Text), New OdbcParameter("@Fourteenthparty", txtFourteenthparty.Text), New OdbcParameter("@Fourteenth", txtFourteenth.Text), New OdbcParameter("@Fourteenthvotes", txtFourteenthvotes.Text), New OdbcParameter("@Fifteenthparty", txtFifteenthparty.Text), New OdbcParameter("@Fifteenth", txtFifteenth.Text), New OdbcParameter("@Fifteenthvotes", txtFifteenthvotes.Text), New OdbcParameter("@Sixteenthparty", txtSixteenthparty.Text), New OdbcParameter("@Sixteenth", txtSixteenth.Text), New OdbcParameter("@Sixteenthvotes", txtSixteenthvotes.Text), New OdbcParameter("@Swing", txtSwing.Text), New OdbcParameter("@Swingtoparty", txtSwingtoparty.Text), New OdbcParameter("@Notes", txtNotes.Text)}

‘Declare an integer variable [index] to be used in the FOR...TO...NEXT loop that follows.’

Dim index as Integer

‘Start a FOR...TO...NEXT loop with index set to 0 It will loop until index is set to the last value in the array [Params]. This is obtained using the length property of Params.’

For index = 0 to Params.Length - 1

‘If the value of the parameter is blank then....’

if Params(index).Value = "" then

‘If it is empty, i.e. txtFourthparty.Text is blank because there isn't a fourth candidate in that particular constituency, then add this parameter to the cmd object with a value of null. This might avoid an error if a field needs to be left blank in the Access 2000 table.’

cmd.Parameters.Add(Params(index)).Value = DBNull.Value

‘Otherwise, if the value of the parameter isn't blank...’

else

‘Add the parameter to the cmd object e.g. fourthparty=‘Con’ will now be added to the Access2000 variable.

cmd.Parameters.Add(Params(index))

‘Ends the IF...THEN...ELSE...END IF block.’

end if

‘Return to the start of the FOR...TO...NEXT block and increase the index variable by 1.’

next

‘Open the connection to the database.’

MyConn.Open()

‘Execute the UPDATE…SET command against the fullresults table but don’t return any records – use the ODBCCommand object’s ExecuteNonQuery method. This will update the record in the table.’

cmd.ExecuteNonQuery()

‘Tidy up the objects before the end of the function.’

cmd.Dispose

MyConn.Close

‘Display an appropriate message in the asp label control [Label3].’

Label3.Text = txtConstituency.Text & "'s record has been updated."

</script>

<html>

<head>

<title>Update a result in the database</title>

<link href=".\otherfiles\election2001.css" type="text/css" rel="stylesheet">

</head>

‘When the page loads the code below displays a form which will be filled with the data of the constituency requested by the user in the textbox named txtConstituency1. There are two asp buttons at the bottom of the form – ‘Update result’ [btnSend] which calls the updateMPs function above and ‘Clear’ [btnClear] which runs the onBtnClearClicked function.’

<body bgcolor="white">

<form id="Form1" method="post" runat="server">

<table width="100%">

<tr>

<td rowspan="2" width="85px"><img src="./images/ballotbox.jpg" title="Cast your vote wisely!"></td>

<td><asp:Label id="Label1" runat="server" ><u>Update a record</u></asp:Label></td>

<td align="right"><asp:LinkButton id="LinkToEdit" onclick="linkToMainMenu" runat="server" Text="Return to the Main menu"></asp:LinkButton></td></tr>

<tr><td colspan="2">&nbsp;</td></tr>

</table>

<p>

<asp:Label id="Label2" runat="server" ><b>Enter the Constituency:</b></asp:Label> <asp:textbox id="txtConstituency1" runat="server" ></asp:textbox> <asp:button id="btnLoad" onclick="loadData" runat="server" forecolor="White" backcolor="Navy" text="Load Constituency's details"></asp:button>

<p>

<asp:Label id="Label3" runat="server" foreColor="red" ><b></b></asp:Label><p>

<center>

<asp:table id="table1" runat="server" bgcolor=#ffffcd cellspacing=0 border=1 bordercolor=silver>

<asp:tablerow><asp:tablecell colspan="4"> </asp:tablecell></asp:tablerow>

<asp:tablerow><asp:tablecell colspan="4"> Country: <asp:textbox id="txtCountry" runat="server" ></asp:textbox>    Region: <asp:textbox id="txtRegion" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow><asp:tablecell colspan="4"> Constituency: <asp:textbox id="txtConstituency" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow><asp:tablecell align="center" id="lblPlace"> </asp:tablecell><asp:tablecell align="center" id="lblParty">Party</asp:tablecell><asp:tablecell align="center" id="lblName">Name</asp:tablecell><asp:tablecell align="center" id="lblVotes">Votes</asp:tablecell></asp:tablerow>

<asp:tablerow><asp:tablecell align="center"><b>1.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFirstparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFirst" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFirstvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow><asp:tablecell align="center"><b>2.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSecondparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSecond" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSecondvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow><asp:tablecell align="center"><b>3.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtThirdparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtThird" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtThirdvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row4"><asp:tablecell align="center"><b>4.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFourthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFourth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFourthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row5"><asp:tablecell align="center"><b>5.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFifthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFifth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFifthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row6"><asp:tablecell align="center"><b>6.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSixthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSixth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSixthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row7"><asp:tablecell align="center"><b>7.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSeventhparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSeventh" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSeventhvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row8"><asp:tablecell align="center"><b>8.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtEighthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtEighth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtEighthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row9"><asp:tablecell align="center"><b>9.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtNinthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtNinth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtNinthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row10"><asp:tablecell align="center"><b>10.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtTenthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtTenth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtTenthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row11"><asp:tablecell align="center"><b>11.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtEleventhparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtEleventh" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtEleventhvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row12"><asp:tablecell align="center"><b>12.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtTwelfthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtTwelfth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtTwelfthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row13"><asp:tablecell align="center"><b>13.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtThirteenthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtThirteenth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtThirteenthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row14"><asp:tablecell align="center"><b>14.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFourteenthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFourteenth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFourteenthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row15"><asp:tablecell align="center"><b>15.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFifteenthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFifteenth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtFifteenthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow id="row16"><asp:tablecell align="center"><b>16.</b></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSixteenthparty" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSixteenth" runat="server" ></asp:textbox></asp:tablecell><asp:tablecell align="center"><asp:textbox id="txtSixteenthvotes" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow><asp:tablecell colspan="4"> </asp:tablecell></asp:tablerow>

<asp:tablerow><asp:tablecell colspan="2"> Turnout: <asp:textbox id="txtTurnout" runat="server" ></asp:textbox> %</asp:tablecell><asp:tablecell colspan="2"> Swing: <asp:textbox id="txtSwing" runat="server" ></asp:textbox> % to <asp:textbox id="txtSwingtoparty" runat="server" ></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow><asp:tablecell colspan="4"><span id="lblNotesspan"> Notes: </span><asp:textbox id="txtNotes" runat="server" textMode="MultiLine" wrap="True"></asp:textbox></asp:tablecell></asp:tablerow>

<asp:tablerow><asp:tablecell colspan="4" align=center><br>Winning party: <asp:textbox id="txtWinningparty" runat="server" ></asp:textbox><p>Result: <asp:textbox id="txtResult" runat="server" ></asp:textbox><br> </asp:tablecell></asp:tablerow>

</asp:table><P>

<asp:button id="btnSend" onclick="updateMPs" runat="server" forecolor="White" backcolor="Navy" text="Update result"></asp:button>

<asp:button id="btnClear" onclick="OnBtnClearClicked" runat="server" forecolor="White" backcolor="Navy" text="Clear"></asp:button>

</center>

</form>

</body>

</html>

***********************************************