I am trying to display the title and descritption of a document on a dropdown menu list but I don't know how to do it. So far it works fine but shows only reference document.

Training Document:  
                <asp:DropDownList ID="TrainingDocIDTextBox" runat="server" 
                    DataSourceID="AccessDataSource2" DataTextField="ReferenceDocument" 
                    DataValueField="TrainingDocID" 
                    SelectedValue='<%# Bind("TrainingDocID") %>' 
                    onselectedindexchanged="TrainingDocIDTextBox_SelectedIndexChanged">
                </asp:DropDownList>

In your Query.... Concate both the Values "title and descritption"
as TitleData

and now

Training Document:&nbsp;&nbsp;
                <asp:DropDownList ID="TrainingDocIDTextBox" runat="server" 
                    DataSourceID="AccessDataSource2" DataTextField="TitleData" 
                    DataValueField="TrainingDocID" 
                    SelectedValue='<%# Bind("TrainingDocID") %>' 
                    onselectedindexchanged="TrainingDocIDTextBox_SelectedIndexChanged">
                </asp:DropDownList>

All The Best

I am trying to display the title and descritption of a document on a dropdown menu list but I don't know how to do it. So far it works fine but shows only reference document.

Training Document:&nbsp;&nbsp;
                <asp:DropDownList ID="TrainingDocIDTextBox" runat="server" 
                    DataSourceID="AccessDataSource2" DataTextField="ReferenceDocument" 
                    DataValueField="TrainingDocID" 
                    SelectedValue='<%# Bind("TrainingDocID") %>' 
                    onselectedindexchanged="TrainingDocIDTextBox_SelectedIndexChanged">
                </asp:DropDownList>

end quote.

Not sure what you meant . Can you please highlight it on my code...

@ Page Title="" Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Certification.aspx.vb" Inherits="Certification" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <p style="text-align: left">
        <br />
        <asp:FormView ID="FormView1" runat="server" DataKeyNames="CertificationID" 
            DataSourceID="AccessDataSource1" DefaultMode="Insert" Height="231px" 
            Width="332px">
            <EditItemTemplate>
                CertificationID:
                <asp:Label ID="CertificationIDLabel1" runat="server" 
                    Text='<%# Eval("CertificationID") %>' />
                <br />
                EmployeeID:
                <asp:TextBox ID="EmployeeIDTextBox" runat="server" 
                    Text='<%# Bind("EmployeeID") %>' />
                <br />
                TrainingDocID:
                <asp:TextBox ID="TrainingDocIDTextBox" runat="server" 
                    Text='<%# Bind("TrainingDocID") %>' />
                <br />
                Started Training:
                <asp:TextBox ID="Started_TrainingTextBox" runat="server" 
                    Text='<%# Bind("[Started Training]") %>' />
                <br />
                Ended Training:
                <asp:TextBox ID="Ended_TrainingTextBox" runat="server" 
                    Text='<%# Bind("[Ended Training]") %>' />
                <br />
                EvalutationType:
                <asp:TextBox ID="EvalutationTypeTextBox" runat="server" 
                    Text='<%# Bind("EvalutationType") %>' />
                <br />
                TrainedBy:
                <asp:TextBox ID="TrainedByTextBox" runat="server" 
                    Text='<%# Bind("TrainedBy") %>' />
                <br />
                NextTraining:
                <asp:TextBox ID="NextTrainingTextBox" runat="server" 
                    Text='<%# Bind("NextTraining") %>' />
                <br />
                Approved:
                <asp:CheckBox ID="ApprovedCheckBox" runat="server" 
                    Checked='<%# Bind("Approved") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>
                Employee :&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:DropDownList ID="EmployeeIDTextBox" runat="server" 
                    DataSourceID="AccessDataSource1" DataTextField="Name" 
                    DataValueField="EmployeeID" SelectedValue='<%# Bind("EmployeeID") %>'>
                </asp:DropDownList>
                <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
                    DataFile="~/App_Data/JABILMCALLEN.mdb" 
                    SelectCommand="SELECT [EmployeeID], [Name], [LastName] FROM [Employees]">
                </asp:AccessDataSource>
                <br />
                <br />
               Training Document:&nbsp;&nbsp;
                <asp:DropDownList ID="TrainingDocIDTextBox" runat="server" 
                    DataSourceID="AccessDataSource2" DataTextField="TitleData" 
                    DataValueField="TrainingDocID" 
                    SelectedValue='<%# Bind("TrainingDocID") %>' 
                    onselectedindexchanged="TrainingDocIDTextBox_SelectedIndexChanged">
                </asp:DropDownList>
                    
                    
                    
                    
                    
                    
                    
                    SelectCommand="SELECT [TrainingDocID], [ReferenceDocument] FROM [TrainingDocuments]">
                </asp:AccessDataSource>
                <br />
                <br />
                Started Training:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:TextBox ID="StartedTrainingTextBox" runat="server" 
                    Text='<%# Bind("[Started Training]") %>' />
                <br />
                <br />
                Ended Training:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:TextBox ID="EndedTrainingTextBox" runat="server" 
                    Text='<%# Bind("[Ended Training]") %>' />
                <br />
                <br />
                EvalutationType:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:DropDownList ID="EvalutationTypeTextBox" runat="server" 
                    SelectedValue='<%# Bind("EvalutationType") %>'>
                    <asp:ListItem>Visual</asp:ListItem>
                    <asp:ListItem>Practico</asp:ListItem>
                </asp:DropDownList>
                <br />
                <br />
                Trained By:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:TextBox ID="TrainedByTextBox" runat="server" 
                    Text='<%# Bind("TrainedBy") %>' />
                <br />
                <br />
                Next Training:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:TextBox ID="NextTrainingTextBox" runat="server" 
                    Text='<%# Bind("NextTraining") %>' />
                <br />
                <br />
                Approved:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <asp:CheckBox ID="ApprovedCheckBox" runat="server" 
                    Checked='<%# Bind("Approved") %>' />
                <br />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insert" />
                &nbsp;&nbsp;&nbsp;
                <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" 
                    CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                CertificationID:
                <asp:Label ID="CertificationIDLabel" runat="server" 
                    Text='<%# Eval("CertificationID") %>' />
                <br />
                EmployeeID:
                <asp:Label ID="EmployeeIDLabel" runat="server" 
                    Text='<%# Bind("EmployeeID") %>' />
                <br />
                TrainingDocID:
                <asp:Label ID="TrainingDocIDLabel" runat="server" 
                    Text='<%# Bind("TrainingDocID") %>' />
                <br />
                Started Training:
                <asp:Label ID="Started_TrainingLabel" runat="server" 
                    Text='<%# Bind("[Started Training]") %>' />
                <br />
                Ended Training:
                <asp:Label ID="Ended_TrainingLabel" runat="server" 
                    Text='<%# Bind("[Ended Training]") %>' />
                <br />
                EvalutationType:
                <asp:Label ID="EvalutationTypeLabel" runat="server" 
                    Text='<%# Bind("EvalutationType") %>' />
                <br />
                TrainedBy:
                <asp:Label ID="TrainedByLabel" runat="server" Text='<%# Bind("TrainedBy") %>' />
                <br />
                NextTraining:
                <asp:Label ID="NextTrainingLabel" runat="server" 
                    Text='<%# Bind("NextTraining") %>' />
                <br />
                Approved:
                <asp:CheckBox ID="ApprovedCheckBox" runat="server" 
                    Checked='<%# Bind("Approved") %>' Enabled="false" />
                <br />
            </ItemTemplate>
        </asp:FormView>
    </p>
    <p style="text-align: left">
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/JABILMCALLEN.mdb" 
            DeleteCommand="DELETE FROM [Certifications] WHERE [CertificationID] = ?" 
            InsertCommand="INSERT INTO [Certifications] ([EmployeeID], [TrainingDocID], [Started Training], [Ended Training], [EvalutationType], [TrainedBy], [NextTraining], [Approved]) VALUES (?, ?, ?, ?, ?, ?, ?, ?)" 
            SelectCommand="SELECT * FROM [Certifications]" 
            UpdateCommand="UPDATE [Certifications] SET [EmployeeID] = ?, [TrainingDocID] = ?, [Started Training] = ?, [Ended Training] = ?, [EvalutationType] = ?, [TrainedBy] = ?, [NextTraining] = ?, [Approved] = ? WHERE [CertificationID] = ?">
            <DeleteParameters>
                <asp:Parameter Name="CertificationID" Type="Int32" />
            </DeleteParameters>
            <UpdateParameters>
                <asp:Parameter Name="EmployeeID" Type="Int32" />
                <asp:Parameter Name="TrainingDocID" Type="Int32" />
                <asp:Parameter Name="Started_Training" Type="DateTime" />
                <asp:Parameter Name="Ended_Training" Type="DateTime" />
                <asp:Parameter Name="EvalutationType" Type="String" />
                <asp:Parameter Name="TrainedBy" Type="String" />
                <asp:Parameter Name="NextTraining" Type="DateTime" />
                <asp:Parameter Name="Approved" Type="Boolean" />
                <asp:Parameter Name="CertificationID" Type="Int32" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="EmployeeID" Type="Int32" />
                <asp:Parameter Name="TrainingDocID" Type="Int32" />
                <asp:Parameter Name="Started_Training" Type="DateTime" />
                <asp:Parameter Name="Ended_Training" Type="DateTime" />
                <asp:Parameter Name="EvalutationType" Type="String" />
                <asp:Parameter Name="TrainedBy" Type="String" />
                <asp:Parameter Name="NextTraining" Type="DateTime" />
                <asp:Parameter Name="Approved" Type="Boolean" />
            </InsertParameters>
        </asp:AccessDataSource>
    </p>
</asp:Content>
<asp:DropDownList ID="EmployeeIDTextBox" runat="server" 
                    DataSourceID="AccessDataSource1" DataTextField="Name" 
                    DataValueField="EmployeeID" SelectedValue='<%# Bind("EmployeeID") %>'>
                </asp:DropDownList>
                <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
                    DataFile="~/App_Data/JABILMCALLEN.mdb" 
                    SelectCommand="SELECT [EmployeeID], [Name], [LastName] FROM [Employees]">
                </asp:AccessDataSource>

Replace your code with

<asp:DropDownList ID="EmployeeIDTextBox" runat="server" 
DataSourceID="AccessDataSource1" DataTextField="EmployeeName" DataValueField="EmployeeID" SelectedValue='<%# Bind("EmployeeID") %>'>
</asp:DropDownList>

<asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/JABILMCALLEN.mdb"
SelectCommand="SELECT [EmployeeID], ([Name] + ' ' + [LastName]) as EmployeeName FROM [Employees]">
</asp:AccessDataSource>

Alle The best

Hi I think that code works for name and lastname..... I need for description and trainingdocument.

Training Document:&nbsp;&nbsp;<asp:DropDownList ID="TrainingDocIDTextBox" runat="server" 
                    DataSourceID="AccessDataSource2" DataTextField="ReferenceDocument" 
                    DataValueField="TrainingDocID" SelectedValue='<%# Bind("TrainingDocID") %>'>
                </asp:DropDownList>
                <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
                    DataFile="~/App_Data/JABILMCALLEN.mdb" 
                    
                    
                    SelectCommand="SELECT [TrainingDocID], [ReferenceDocument] FROM [TrainingDocuments]">
                </asp:AccessDataSource>

HI this is what it actually works:

Training Document:&nbsp;&nbsp;<asp:DropDownList ID="TrainingDocIDTextBox" runat="server" 
                    DataSourceID="AccessDataSource2" DataTextField="Description" 
                    DataValueField="TrainingDocID" SelectedValue='<%# Bind("TrainingDocID") %>'>
                </asp:DropDownList>
                <asp:AccessDataSource ID="AccessDataSource2" runat="server" 
                    DataFile="~/App_Data/JABILMCALLEN.mdb" 
                    
                    
            SelectCommand="SELECT [TrainingDocID], [ReferenceDocument] +':' + [Description] as Description FROM [TrainingDocuments]">

Yes... its gr8... finally u got ur solution.. All the Best

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.