Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
| Search | Today's Posts | Mark Forums Read
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 8th, 2004, 05:22 AM
Registered User
Join Date: Aug 2004
Location: tehran, , Iran.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default how can get selectedindex in dropdown list

how can get selectedindex in dropdown list when i use dropdownlist in html code and this is into the datalist this means i havenot use findcontrol in code behine beacuse this object not initialize

<asp:DropDownList ID="Dropdownlist1" Runat="server" DataSource='<%#FillGroup()%>' DataTextField="cat_name" DataValueField="Cat_id" >
public System.Data.DataSet FillGroup()//--new for forum App
            System.Data.DataSet DS = new System.Data.DataSet();

            sqlCmd.CommandText =" SELECT Cat_id,cat_name FROM Category where c_statuse=1 and C_public=0 ";
            System.Data.DataRow dr = DS.Tables[0].NewRow();
            dr["Cat_id"] = "-1";
            dr["cat_name"] = "ÇäÊÎÇÈ ÇÒ áíÓÊ...";
            DS.Tables[0].Rows.InsertAt(dr, 0);
            return DS;
        public string FillDropDown(object ,System.EventArgs e )
            DataListItem anItem in datalist (is this correct

            DropDownList dropdown =((DropDownList)anItem.FindControl("Dropdownlist1" ));

            return dropdown.SelectedItem.Value;
thank's for your help

Similar Threads
Thread Thread Starter Forum Replies Last Post
Dropdown list maha .NET Framework 2.0 7 April 28th, 2007 12:32 AM
fill dropdown list with items when parent list isaac_cm Pro PHP 1 July 10th, 2006 05:41 AM
HELP WITH DROPDOWN LIST enavas Excel VBA 1 April 6th, 2004 02:08 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.