updating value from selectedvalue of DD is null

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ben

    updating value from selectedvalue of DD is null

    Hi,


    With this code, when i click on Update button, the value updated of field
    "wa" in the table is NULL.The update of the other field (not in a DD) works
    good.
    It seems that the selectedvalue of the dropdownlist (which exists, i tested
    it with response.write) is not used as updating value.

    Any idea why?
    thanks
    Ben

    UpdateCommand=" UPDATE [condition] SET [wa] = @wa, [operator] = @operator
    WHERE [id] = @id">

    <UpdateParamete rs>
    <asp:Paramete r Name="wa" Type="String" />
    <asp:Paramete r Name="operator" Type="String" />
    </UpdateParameter s>

    <asp:TemplateFi eld HeaderText="wa" >
    <EditItemTempla te>
    <asp:DropDownLi st ID="DropDownLis t1" runat="server">
    </asp:DropDownLis t>
    </EditItemTemplat e>
    <ItemTemplate >
    <asp:Label ID="Label1" runat="server" Text='<%# Bind("wa")
    %>'></asp:Label>
    </ItemTemplate>
    </asp:TemplateFie ld>

    Protected Sub GridView1_RowDa taBound(ByVal sender As Object, ByVal e As
    System.Web.UI.W ebControls.Grid ViewRowEventArg s) Handles
    GridView1.RowDa taBound

    If (e.Row.RowState And DataControlRowS tate.Edit) =
    DataControlRowS tate.Edit Then
    If e.Row.RowType = DataControlRowT ype.DataRow Then
    Dim dd As DropDownList
    Dim i As Integer
    Dim z As ListItem
    dd = e.Row.FindContr ol("DropDownLis t1")
    For i = 1 To 20
    z = New ListItem(i, i)
    dd.Items.Add(z)
    Next
    dd.SelectedValu e = DataBinder.Eval (e.Row.DataItem ,
    "wa").ToString( )
    Response.Write( dd.SelectedValu e)
    End If
    End If
    End Sub



Working...