After binding the data to your dropdown, check to see if you have a valid ID. If you do not, then SelecteIndex = 0.
Example:
"ValueToBeSelected" is the ID coming from your database that you want selected in the dropdown----
After binding the data:
If IsDBNull(ValueToBeSelected) or...
You're getting this error because intWickets = 0.
if intBallsBowled = 0 then
decStrikeRate = 0
else
If intWickets > 0 Then
decStrikeRate = formatnumb((intBallsBowled/intWickets),2)
End If
end if
Neil,
Do the following to insert into your dropdown. Do this after the databind. The first line inserts the item in at the beginning of the dropdown. The second line then sets the dropdown index to display the first value just inserted.
MyDropDown.Items.Insert(0,"Choose From...
Neil,
I have done this by combining the two fields in the sql statement.
Ex: Select ID + " - " + Description As IDDesc
Then bind IPDesc to your dropdown.
You need to do an outside join on the Sales Order field between the two tables. This will bring back everything that is in the Sales table that meets your criteria regardless if it is in the Variation table or not.
By the way, if you do it during your databound sub routine you don't have to worry about those "pesky tags" in your update and insert statements.
Do your replace when you are binding everything in your ItemDataBound sub routine:
Private Sub Repeater1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles Repeater1.ItemDataBound
[Replace code here]
End Sub
I use this...
<option value=0>-Select One-</option>
Then I check for the value of zero and if I see it then I place whatever I want into the database based on the value.
SELECT a.Firstname, a.Lastname
FROM Contestants a, Roundresults b
WHERE a.ContID <> b.ContID
This will return the first and last names of everyone who is not listed in the Roundresults table.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.