Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6686561
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:11:08+00:00 2026-05-26T05:11:08+00:00

I’m having a bit of trouble figuring this one out. I have a dropdownlist

  • 0

I’m having a bit of trouble figuring this one out.

I have a dropdownlist (populated from a datasource that concatenates first and last names, and the value is an “employee ID”, oh and it’s a sql server database).

I also have a formview, that displays all the “employee” information (same database, different sqldatasource. What I’m trying to do is when a user selects an employee from the dropdownlist, it finds the page with the matching employee ID and displays that page.

The formview also needs to keep the paging, to allow a user to select next or previous if needed. (It’d also be nice if the ddl would update on next and previous to show the current viewed employee).

Currently, I have the ddl inside the formview, with a

SelectedValue='<%# Eval("Employee_ID") %> (which I'm hoping will take care of the ddl showing part, haven't tested that bit as I just woke up,heh).

I have autopostback in the ddl set to true, and it is firing the OnSelectedIndexChanged event, I’m just not sure what to do next. (more specifically, I guess I don’t know how in C# to find the page with the matching “employee id”.

Thanks much for any help!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T05:11:09+00:00Added an answer on May 26, 2026 at 5:11 am

    I think this is big example , how to bind and update the form view using drop down select item….

        <asp: ObjectDataSource ID="ObjectDataSource1" runat="server" DeleteMethod="Delete"
            InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
            TypeName="DataSet1TableAdapters.teachersTableAdapter" UpdateMethod="Update">
         <DeleteParameters>
           <asp: Parameter Name="Original_PKID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
           <asp: Parameter Name="name" Type="String" />
           <asp: Parameter Name="lastname" Type="String" />
           <asp: Parameter Name="department" Type="Int32" />
           <asp: Parameter Name="PKID" Type="Int32" />
        </UpdateParameters>
        <InsertParameters>
             <asp: Parameter Name="name" Type="String" />
             <asp: Parameter Name="lastname" Type="String" />
             <asp: Parameter Name="department" Type="Int32" />
        </InsertParameters>
      </asp: ObjectDataSource>
        <br />
    
       <asp: ObjectDataSource ID="ObjectDataSource2" runat="server" DeleteMethod="Delete"
        InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetData"
        TypeName="DataSet1TableAdapters.departmentsTableAdapter" UpdateMethod="Update">
        <DeleteParameters>
            <asp: Parameter Name="Original_PKID" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
           <asp: Parameter Name="departmentName" Type="String" />
           <asp: Parameter Name="PKID" Type="Int32" />
        </UpdateParameters>
          <InsertParameters>
             <asp: Parameter Name="departmentName" Type="String" />
            </InsertParameters>
          </asp:ObjectDataSource></div><br />
    
          <asp: FormView ID="FormView1" runat="server" AllowPaging="True" DataKeyNames="PKID"
           DataSourceID="ObjectDataSource1" OnDataBound="FormView1_DataBound">
        <EditItemTemplate>
          PKID:
           <asp: Label ID="PKIDLabel1" runat="server" Text='<%# Eval("PKID") %>'></asp:Label><br />
           name:
            <asp: TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>'>
              </asp: TextBox><br />
            lastname:
           <asp: TextBox ID="lastnameTextBox" runat="server" Text='<%# Bind("lastname") %>'>
        </asp: TextBox><br />
           department:
            <asp: TextBox ID="departmentTextBox" runat="server" Text='<%# Bind("department") %>'>
             </asp:TextBox><br />
           <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
              Text="Update">
          </asp: LinkButton>
             <asp: LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"             CommandName="Cancel"
        Text="Cancel">
             </asp: LinkButton>
         </EditItemTemplate>
        <InsertItemTemplate>
        name:
        <asp: TextBox ID="nameTextBox" runat="server" Text='<%# Bind("name") %>'>
        </asp: TextBox><br />
        lastname:
        <asp: TextBox ID="lastnameTextBox" runat="server" Text='<%# Bind("lastname") %>'>
        </asp: TextBox><br />
        department:
        <asp: TextBox ID="departmentTextBox" runat="server" Text='<%# Bind("department") %>'>
        </asp: TextBox><br />
        <asp: LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
        Text="Insert">
        </asp: LinkButton>
        <asp: LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
        Text="Cancel">
        </asp: LinkButton>
        </InsertItemTemplate>
        <ItemTemplate>
        PKID:
        <asp: Label ID="PKIDLabel" runat="server" Text='<%# Eval("PKID") %>'></asp:Label><br />
        name:
        <asp: Label ID="nameLabel" runat="server" Text='<%# Bind("name") %>'></asp: Label><br />
        lastname:
        <asp: Label ID="lastnameLabel" runat="server" Text='<%# Bind("lastname") %>'></asp: Label><br />
        department:
        <asp: DropDownList ID="DropDownList1" runat="server" DataSourceID="ObjectDataSource2"
        DataTextField="departmentName" DataValueField="PKID">
        </asp: DropDownList><br />
        <asp: LinkButton ID="EditButton" runat="server" CausesValidation="False" CommandName="Edit"
        Text="Edit"></asp: LinkButton>
        <asp: LinkButton ID="DeleteButton" runat="server" CausesValidation="False" CommandName="Delete"
        Text="Delete"></asp: LinkButton>
        <asp: LinkButton ID="NewButton" runat="server" CausesValidation="False" CommandName="New"
        Text="New"></asp: LinkButton>
        </ItemTemplate>
        </asp: FormView>
    
    In the code behind i used itemdatabound event of the formview so that i set the <strong class="highlight">selected</strong> value for the dropdownlist as follows : 
    
    
    
    protected void FormView1_DataBound(object sender, EventArgs e)
    {
            DataRowView drv = (DataRowView)FormView1.DataItem;
            ((DropDownList)FormView1.FindControl("DropDownList1")).SelectedValue = drv["department"].ToString();
     }
     protected void FormView1_DataBound(object sender, EventArgs e)
     {
            DataRowView drv = (DataRowView)FormView1.DataItem;
            ((DropDownList)FormView1.FindControl("DropDownList1")).SelectedValue = drv["department"].ToString();
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I know there's a lot of other questions out there that deal with this
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.