DetailView

G

Guest

How can I use a dropdownlist in DetailView?

Protected Sub PeopleDetail_ItemUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DetailsViewUpdateEventArgs)
' Some hocus pocus
End Sub
<asp:TemplateField HeaderText="Status">
<ItemTemplate >
</ItemTemplate>
<EditItemTemplate>
<asp:DropDownList ID="StatusList2"
DataValueField="status" runat="server">
<asp:ListItem Value="A">Active</asp:ListItem>
<asp:ListItem Value="M">Moved</asp:ListItem>
</asp:DropDownList>
</EditItemTemplate>
</asp:TemplateField>
 
G

Guest

1- Get a reference to the dropdownlist:
Dim ddl as DropDownList = Ctype(DetailsView1.FindControl("StatusList1") ,
DropDownList)

2- update the new values:
e.NewValues("Status") = ddl.SelectedValue
 
G

Guest

Phillip,
That will not compile this time.
System.Web.UI.WebControls.DetailsViewInsertedEventArgs does have a newvalues
collection.
But e.Values("status") = ddl.SelectedValue works if I change to the
PeopleDetail_ItemInserting event

Arne.
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top