dropdownlist in datagrid edit mode

Discussion in 'ASP .Net' started by Luis Esteban Valencia, Sep 29, 2004.

  1. I need to put in the edit mode a dropdownlist with the correct value
    selected.



    On the template I have this

    <ItemTemplate>
    <asp:Label id=Label4 runat="server" Text='<%#
    DataBinder.Eval(Container, "DataItem.strTipoContrato") %>'>
    </asp:Label>
    </ItemTemplate>
    <EditItemTemplate>

    <asp:DropDownList id="tipocontratot"
    runat="server"></asp:DropDownList>
    </EditItemTemplate>

    On the codebehind I have this.

    Private Sub dgpolizas_ItemCommand(ByVal source As Object, ByVal e As
    System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
    dgpolizas.ItemCommand

    Select Case e.CommandName

    Case "Edit"

    dgpolizas.EditItemIndex = e.Item.ItemIndex

    cargarpolizas()

    Dim tipocontratot As DropDownList

    tipocontratot = e.Item.FindControl("tipocontratot")

    Dim myadp As New SqlDataAdapter("select * from tbltipocontrato", myconn)

    Dim myds As New DataSet

    myadp.Fill(myds, "tbltipocontrato")

    tipocontratot.DataSource = myds.Tables("tbltipocontrato").DefaultView

    tipocontratot.SelectedValue = ???

    tipocontratot.DataBind()



    Thanks



    --
    LUIS ESTEBAN VALENCIA
    MICROSOFT DCE 2.
    MIEMBRO ACTIVO DE ALIANZADEV
     
    Luis Esteban Valencia, Sep 29, 2004
    #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. =?Utf-8?B?TmV3VG9Eb3ROZXQ=?=

    TextBox and DropDownList in Datagrid Edit mode

    =?Utf-8?B?TmV3VG9Eb3ROZXQ=?=, Jan 30, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    798
    =?Utf-8?B?TmV3VG9Eb3ROZXQ=?=
    Feb 9, 2004
  2. =?Utf-8?B?RGF2ZQ==?=
    Replies:
    2
    Views:
    4,850
    =?Utf-8?B?RGF2ZQ==?=
    Dec 17, 2004
  3. =?Utf-8?B?VGltOjouLg==?=

    Datagrid DropdownList in edit mode???

    =?Utf-8?B?VGltOjouLg==?=, Dec 22, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    2,315
    Saravana
    Dec 22, 2004
  4. Frank Kurka
    Replies:
    8
    Views:
    312
  5. jobs at webdos
    Replies:
    0
    Views:
    478
    jobs at webdos
    Oct 9, 2006
Loading...

Share This Page