Logo 
Search:

Asp.net Answers

Ask Question   UnAnswered
Home » Forum » Asp.net       RSS Feeds
  Question Asked By: Asksuresh Programmer   on Nov 27 In Asp.net Category.

  
Question Answered By: Clay Cook   on Nov 27

When ever you are working with grids, you need to make sure when you do
the findcontrol method that the control actually exists on that row of
the grid.

What trips up a lot of people when working with the OnItemEvents is the
header row and the footer row are run through here as well and as such
do not contain the controls you are looking for.


Dim drop1 As DropDownList = e.Item.FindControl("myDDL")
If not isNothing(drop1) then

Dim myDataSet As DataSet

Dim myDataTable As DataTable

myDataSet = CType(Session("data"), DataSet)

myDataTable = myDataSet.Tables("Tabel")

Dim myDataView As DataView

myDataView = New DataView(myDataTable)

drop1.DataSource = myDataView

drop1.DataMember = "Tabel"

drop1.DataTextField = "joke"

drop1.DataValueField = "aantal"

drop1.DataBind()

End if

Share: 

 

This Question has 6 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on binding dropdownlist to datagrid Or get search suggestion and latest updates.


Tagged: