dropdown list can't selected.

Discussion in 'ASP .Net' started by lucy, Aug 5, 2003.

  1. lucy

    lucy Guest

    I have a EditItemTemplate in a datagrid that contain a
    dropdown that bound to a dataset. In that grid I have a
    ItemCreated to handle the dropdow created. But the
    selected item is not work. I tried 3 ways. see code.

    Thanks.


    Private Sub dgFundList_ItemCreated(ByVal sender As
    Object, ByVal e As
    System.Web.UI.WebControls.DataGridItemEventArgs) Handles
    dgFundList.ItemCreated
    Dim elemType As ListItemType
    elemType = e.Item.ItemType

    If elemType = ListItemType.EditItem Then
    Dim ddlUserName As DropDownList = CType
    (e.Item.FindControl("ddlUserName"), DropDownList)

    ddlUserName.DataSource = dtUser
    ddlUserName.DataTextField = "FullName"
    ddlUserName.DataValueField = "UserID"

    ddlUserName.DataBind()
    'ddlUserName.SelectedItem.Selected = False
    'ddlUserName.Items.FindByValue
    ("11111").Selected = true
    'ddlUserName.Items.FindByText
    ("mytext").Selected = True
    ddlUserName.SelectedIndex =
    ddlUserName.Items.IndexOf(ddlUserName.Items.FindByValue
    ("11111"))
    End If
     
    lucy, Aug 5, 2003
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lucy
    Replies:
    0
    Views:
    308
  2. rohith
    Replies:
    3
    Views:
    6,001
    rohith
    Aug 29, 2003
  3. vishnu
    Replies:
    1
    Views:
    1,217
    Patrick.O.Ige
    Mar 25, 2006
  4. mldardy
    Replies:
    1
    Views:
    753
    mldardy
    Dec 10, 2008
  5. John
    Replies:
    5
    Views:
    1,000
    dorayme
    Mar 1, 2010
Loading...

Share This Page