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

  • SEARCH
  • Home
  • 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 6208837
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T05:52:33+00:00 2026-05-24T05:52:33+00:00

<asp:DetailsView ID=DetailsView1 runat=server AutoGenerateRows=False DataSourceID=TimeEntriesDataSource RowStyle-VerticalAlign=Top DefaultMode=Insert HeaderStyle-HorizontalAlign=Center BackColor=White BorderColor=#336666 BorderStyle=Double BorderWidth=3px CellPadding=4 OnItemInserted=DetailsView1_ItemInserted

  • 0
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"       DataSourceID="TimeEntriesDataSource"
                            RowStyle-VerticalAlign="Top" DefaultMode="Insert" HeaderStyle-HorizontalAlign="Center"
                            BackColor="White" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px"
                            CellPadding="4" OnItemInserted="DetailsView1_ItemInserted" OnItemCommand="DetailsView1_ItemCommand"
                            OnItemInserting="DetailsView1_ItemInserting">
                            <RowStyle VerticalAlign="Top" BackColor="White" ForeColor="#333333"></RowStyle>
                            <PagerStyle BackColor="#336666" ForeColor="White" HorizontalAlign="Center" />
                            <Fields>
                                <asp:TemplateField HeaderText="Group">
                                    <InsertItemTemplate>
                                        <asp:DropDownList ID="ddlGroups" runat="server"     DataSourceID="GroupsDataSource" DataTextField="Name"
                                            DataValueField="Id" AppendDataBoundItems="true" ValidationGroup="InsertTimeEntry"
                                            AutoPostBack="true" OnSelectedIndexChanged="ddlGroups_SelectedIndexChanged">
                                            <asp:ListItem Selected="True" Text="-- Select --" Value=""></asp:ListItem>
                                      </asp:DropDownList>

                                        <asp:ObjectDataSource ID="GroupsDataSource" runat="server" SelectMethod="GetSortedActiveGroups"
                                            TypeName="NicorNational.TimeTracker.BLL.Gateway"></asp:ObjectDataSource>
                                    </InsertItemTemplate>
                                </asp:TemplateField>

                            </Fields>
                            <EditRowStyle Font-Bold="True" />
            </asp:DetailsView> 

How can we write JQuery function to get Dropdownlist from Details View? I need to alert user if there is any change in Dropdownlist. im writing something like this but it is not getting fired when dropdown values is changed by user.

             $(document).ready(function () {
                           $(#ddlGroups).change(function () {
                               alert("Hello world!");
                           });
                        });

[EDIT] I have one more question. Based on the dropdown selection I need to get the corresponding Description from the ObjectDataSource. Here is the Server Side Code.
Can you please give me equivalent JQuery function?

              protected void ddlActivityTypes_SelectedIndexChanged(object sender, EventArgs e)
                    {
                        string description = string.Empty;
                        var ddlActivityTypes = DetailsView1.FindControl("ddlActivityTypes") as DropDownList;
                        var textBox1 = DetailsView1.FindControl("TextBox1") as TextBox;
                        var activityDataSource = DetailsView1.FindControl("ActivityTypesDataSource") as ObjectDataSource;

                        if (!string.IsNullOrEmpty(ddlActivityTypes.SelectedValue))
                        {
                            IEnumerable IDs = activityDataSource.Select();

                            foreach (ActivityType item in IDs)
                            {
                                if (item.Name == ddlActivityTypes.SelectedItem.Text.ToString())
                                {
                                    description = item.Description;
                                }
                            }

                            textBox1.Text = description;
                        }

                    }

I was trying something like this in JQuery, but it doesn’t work.

                   $(document).ready(function () {
                       $('select[id*=ddlActivityTypes]').change(function () {
                           var selectedText = $('select[id*=ddlActivityTypes]').find("option:selected").text(); ;
                           var data = $('select[id*=ActivityTypesDataSource]').select();

                           data.each(function () {
                               if (selectedText == this.Name) {
                                   alert(this.description);
                               }

                       });
                   });
  • 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-24T05:52:34+00:00Added an answer on May 24, 2026 at 5:52 am

    I am assuming this “DropDownList” can be rendered with a different “clientID” , you can try this:

                      $(document).ready(function () {
                           $('select[id*=ddlGroups]').change(function () {
                               alert("Hello world!");
                           });
                        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I write code like this: <asp:DetailsView ID=DetailsView1 Runat=server DataSourceID=Vote DefaultMode=Insert AutoGenerateRows=False DataKeyNames=id Width=352px
I have a DetailsView like this: <asp:DetailsView ID=detailsView1 runat=server DataSourceID=edsdetailsView AutoGenerateRows=False CssClass=pretty-table> <Fields> <asp:TemplateField
I have a control that look something like this: <asp:DetailsView ID=dvUsers runat=server DataSourceID=odsData DataKeyNames=Id>
Ok so i have a DetailsView like so... <asp:DetailsView DataSourceID=sqldsNewItem CssClass=marginLeftRightBottom10px DefaultMode=Insert FieldHeaderStyle-CssClass=dwHeader GridLines=None
For ASP.NET, I'm using a DetailsView for insert and edit of a record. For
I have 2 DetailsView. The first one is hidden (display:none) with DefaultMode=Insert, has RequiredFieldValidator
I'm using an asp:DetailsView control with auto generated Edit and Insert buttons. So far
Say you have something like an ASP.NET ASP:DetailsView to show and edit a single
I used the ASP.NET DetailsView across my application. I would like to know how
I currently have a DetailsView in ASP.NET that gets data from the database based

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.