troubleshooting Question

how do i set the value of a dropdownlist that is in a gridview?

Avatar of Amien90
Amien90 asked on
2 Comments1 Solution370 ViewsLast Modified:
Protected Sub gridview1_rowdatabound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound

        Dim ddlAccount As DropDownList = CType(e.Row.FindControl("ddlAccount"), DropDownList)
           ddlAccount.SelectedValue = ddlAccount.Items.FindByText("TEST").Value

    End Sub

i get this error : Object reference not set to an instance of an object.

TEST is in my dropdownlist as selection option
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros