Make an item's value equal zero in drop down list

I added an item to a drop down list located in a DataGrid in the ItemDataBound event.
The drop down list is first populated from the database like this:

Public Function FillDropdown() As System.Data.SqlClient.SqlDataReader
      Return Catalog.GetGifts
End Function

<asp:DropDownList ID="ddlGifts" DataSource='<%# FillDropDown %>' DataValueField="GiftID" DataTextField="Event" Runat=server></asp:DropDownList>

I need to set its VALUE to zero so I can check for this value later.  
This works but it doesn't set it's VALUE to zero:

Private Sub productsGrid_ItemDataBound
Dim ddl As DropDownList
ddl = e.Item.Cells(1).FindControl("ddlGifts")
ddl.Items.Insert(0, "Select Gift Category")  << need to make the Value = 0

Right now, this (Gift) equals "Select Gift Category" not zero, which I need:

Dim Gift As String = CType(e.Item.Cells(1).FindControl("ddlGifts"), DropDownList).SelectedValue
LVL 16
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.


try this

            Dim Gift As DropDownList = CType(e.Item.FindControl("Gift "), DropDownList)
            Gift .Items.Insert(0, New ListItem("0", "0"))


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial

You can do the item.insert after binding the dropdownlist in the itembound event.

Since that first val is hard-coded, you could just check for the text....

Dim Gift As String = CType(e.Item.Cells(1).FindControl("ddlGifts"), DropDownList).SelectedValue
If Gift <> "Select Gift Category"
'do something
'do something else
End If

Or, use the selected index, since it's hardcoded to zero (first) position.

If CType(e.Item.Cells(1).FindControl("ddlGifts"), DropDownList).SelectedIndex <> 0 Then
'do something
'do something else
End if

happy 4th!
MikeMCSDAuthor Commented:
ayha . . thanks!!!!!!! works perfect
I was trying to find how to use the ListItem in code but just couldn't get it.

sam, thanks, that would have worked also
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.