UpdateCommand="UPDATE [zEdits] SET [Supervisor] = @Supervisor WHERE [ID] = @ID"> <asp:Parameter Name="Supervisor" Type="String" /> <%--other parameters removed--%> <asp:Label ID="lblSupervisor" runat="server" Text="Supervisor:" class="styleDBLabeltag" /> <asp:Button ID="AddSupervisorItem" runat="server" OnClick="btnAddSupervisor_Click" /> <asp:Button ID="SupervisorItemAdded" runat="server" OnClick="btnSupervisorAdded_Click" Visible="false" /> <asp:DropDownList ID="DropDownListSupervisor" runat="server" AutoPostBack="true" DataSourceID="SupervisorDDLSelect" DataValueField="Name" > <asp:SqlDataSource ID="SupervisorDDLSelect" runat="server" ConnectionString="<%$ ConnectionStrings:PKLConnectionString %>" SelectCommand="SELECT [LastName] + ', ' + [FirstName] as Name FROM [tblPersonnel] ORDER BY [Name]">
Protected Sub btnAddSupervisor_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim txtSupervisorValue As TextBox = Me.FormView1.FindControl("SupervisorLabel1") Dim ddlSupervisor As DropDownList = Me.FormView1.FindControl("DropDownListSupervisor") 'Dim lstSupervisorItem As ListItem 'Dim SupervisorStringToFind As String txtSupervisorValue.Visible = True ddlSupervisor.Visible = True Me.FormView1.FindControl("SupervisorItemAdded").Visible = True Me.FormView1.FindControl("AddSupervisorItem").Visible = False End Sub Protected Sub btnSupervisorAdded_Click(ByVal sender As Object, ByVal e As System.EventArgs) Dim txtSupervisorValue As TextBox = Me.FormView1.FindControl("SupervisorLabel1") Dim ddlSupervisor As DropDownList = Me.FormView1.FindControl("DropDownListSupervisor") 'Dim lstSupervisorItem As ListItem Dim SupervisorStringToFind As String SupervisorStringToFind = txtSupervisorValue.Text ddlSupervisor.Items.Insert(0, SupervisorStringToFind) ddlSupervisor.SelectedValue = SupervisorStringToFind End Sub
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)