About dropdown list selected item and selected value

hi to all

i have one table. that have albhapetic list of countries name and country id. i want to bind country table to dropdownlist. dropdownlist text field is country name the value field country id.the dropdown list heading is "-- select country--". but page load time i want load default country is INDIA and value is ind. guide me how achieve this scnario.

0
devangopinathan
2/7/2008 12:05:39 PM
asp.net.getting-started 91979 articles. 4 followers. Follow

2 Replies
1137 Views

Similar Articles

[PageSpeed] 46

You can write following line in Page load event.

ddCountryDropDownList.SelectedValue = "ind";

Hope this helps! 


Programmers are tools for converting caffeine into code

Visit my blog
0
rasesh_dave
2/7/2008 12:46:08 PM

Try this way instead

DropDownList1.Items.FindByText("INDIA").Selected = true; 

or

DropDownList1.Items.FindByValue("ind").Selected = true;


Regards,Vinz

"Code, Beer and Music" that's my way of being a programmer!

How to get your Forum Question Answered | Blog | CodeASP.NET
0
vinz
2/7/2008 1:02:43 PM
Reply:

Similar Artilces:

Cascading Dropdown List
Hi, First post so hello and need some help with an issue I have been dealing with.  I have an intranet page I created in ASP.NET using C# .NET 3.5 with a few Ajax Extenders including 3 Cascading Dropdown Lists. Now I have used the Cascading dropdown lists for my own purposes i.e they do not actually cascade their results to another dropdown list, the reason I did this was due to the having a User Control that contains an update panel and other bits i.e I didn't want the control/page posting page (something that happens when you click on a regular dropdown list). Everything is wor...

Getting the selected value of the first databound item in a dropdown list
Does anyone know how to get the SelectedValue out of the drop down list if the First Item is selected within the list.  The only way I know of doing this is by putting a button there and giving the user the option of pressing the button as well as selecting from the list.  RegardsRB Have you contemplated setting 'AutoPost=true' and having the DDL invoking the OnSelectedItemChanged Event on the server?RegardsAndre Colbiornsen ---------------------------------Seventh DayRåbygatan 1A,SE-223 61 LundSwedenMob.: +46-(0)708-97 78 79Mail: info@seventhday.se-------------------------------...

To get the value of a selected item in dropdown list within a header template in Datagrid
Hi All, I have added a Dropdownlist within a header template in a datagrid. I am able to bind the data to the dropdownlist, but I am not able to get the selected item value of that Dropdownlist. My question is how to get the selected Item value of the dropdownlist within the header template of a datagrid. Thanks in advance, Regards, deepa Can you be a little more specific? Are you trying to access the selected value from another control on the page or from within the control itself? Jason Bentley...

Password text value gets deleted when value selected from Dropdown list
Hi, I need help in my dropdown control, this is what my problem is I am using DropDown List in my aplication in a form and i want to show some default selected value in the first drop down D1 and depending on values selected in D1 the values gets displayed in the child drop down D2. My issue is i have a password texbox before getting valued from D1 and D2......when i select value from D1 the password enetered in hte password textbox in password mode gets deleted. so every time he user types the password and then select something in the dropdown, he has to ...

Getting selected value for a DDL (dropdown list)
Hi All, I hope somebody can point me in the right direction. My problem is this: I am using a DDL to get a list of files from a specific folder on the server which is working fine. (using the code below) Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim testPath As String = Server.MapPath("~/UserImages\Pdf\") For Each file As String In System.IO.Directory.GetFiles(testPath, "*.pdf") Dim fi As System.IO.FileInfo = New System.IO.FileInfo(file) CType(DetailsView1.FindControl(...

Problems in getting selected value from a dropdown list
 Hi!!im using a dropdown list in a gridview. the list is databound to a table. im trying to retreive the selected value in the click event of a button, but i always get the first value. i have visited many forums but couldnt get anything.can anyone help me?? Thnx. Dessi:the list is databound to a table. Where is this code ? If it's in Page_Load, you have to check for !IsPostBack condition.. if(!IsPostBack) { //DropDownList DataBinding code.. }  My Blog"Don't be afraid to be wrong; otherwise you'll never be right."  the code is writt...

Get all values from database if no dropdown item is selected ?
HiIn my web application, i use some dropdown lists and a submit button to filter a gridview on another pagestr = "res.aspx?ddl1=" + ddl1.SelectedItem.ToString + "&ddl2=" + ddl2.SelectedItem.ToStringResponse.Redirect(str)I'd like to get all values from the database if no item is selected from the dropdown lists .What should the SQL look like for the select in the sqldatasource ?Thanks.  What you can do is send 0 to the parameter in stored procedure if dropdown value is not selected. and in the stored procedure just put a if condition to get the appropriate d...

Populate dropdown list based on selected value in another dropdown list
I have a datagrid (grdCar) that contains two dropdown listboxes (ddlCarManf and ddlCar). When the user clicks the "Edit" link and places the grid into edit mode, they select a value in ddlCarManf. Based on the selected value in ddlCarManf, I need to then populate ddlCar with a list of cars for which the selected manufacturer makes (I'm using ddlCarManf.SelectedValue to query the database).  I bind my datagrid in the page_load event as: If Not Page.IsPostBack Then    BindGrid() End If Here is my control (ddlCarManf) as is appears within grdCar in ...

Dropdownlist selected value passes first value in list no matter what value is selected. why ?
 HI . I have a dropdownlist. Databinds ok but when I must pass a value as a Selected value it always passes the first value in the list even if I select another value. I tried to set the ddl to enableviewstate false but it doesn't change anything. Any ideas ? Code below, thanksLoading the ddl:       productCategories = CatalogAdmin.Admin_Product_Categories_NotIn(productId);        for (int i = 0; i < productCategories.Rows.Count; i++)        {       &...

Option List
In IE, the code below results in a select box with "Mow Requested" as the selected item. In Firefox, it doesn't - the select is displayed, but the initial selected item isn't set. I can get it to initialize using JavaScript (documents.forms.formname.itemname.value=5) but that isn't a practical option for this application. Is there some way to make this work as documented in Firefox? <FORM NAME=formname> <SELECT NAME='itemname'> <OPTION VALUE='1'>Reported</OPTION> <OPTION VALUE='2'>Posted Notice</OPTION&...

how can i get the selected value of cascading dropdown list
Hi all can anybody please help me about the following matter....I used  cascading dropdown list and when fetch the value from this dropdown list using  EnableEventValidation="false" ,its working.  But i dont want to use EnableEventValidation="false" for security purpose. is there any other option for this? please help me.       Hi,From your description, I understand that you would like to use the CascadingDropDown with the EnableEventValidation="true".Please refer to this thread which has a similar request to yours here : h...

Dropdown list value get selected as user type in.........
Is there any way by which Item value of Dropdown list get selected as user type Item value initials. e.g There are 3 values in Dropdown List 1) Amit 2) Manish 3) Mukesh as user type 'Ma' in the Dropdown list, value 'Manish' get selected Thanks Regards Parshant Kalia If the user hits M, it jumps to the first M entry. If the user then keeps hitting M, it scrolls through all of the M's. This is how it works in IE at least. BrianBrian"Trust in the Lord and do what is good; dwell in the land and live securely. Take delight in the Lord, and H...

Getting DropDownlist's DataTextValue Selected Value Given the SelectedValue and/or Selected Item
In the vb.net codebehind, I need to extract something from the Text (displayed) value of dropdownlist's selected item and I have  the SelectedValuand and SelectedItem in hand. How can I do this?  FindControl? Item? row?   Thanks. Well, its easier than you might think. SelectedItem has a "text" property. Thats the selected text right there :)  If you need the Text of the selection, then you have to use the SelectedItem.Text property.  If you want the value (not the displayed text) the you can directly use the SelectedValue. dim sText as String = dropdown...

Why is the select saying selected after an item is selected?
This was a whitelisting issue due to a software upgrade at hostgator..  Nothing wrong with my code..Scot King SEO Software Tool | Search Engine Optimization"Get your page rank high"  huh? It is smart to put your question in the body and not just in the title. Have no idea what your question is or if it even a question.Eric Pascarello.com | Twitter epascarello | LinkedIn use thisddl.options[ddl.selectedIndex].selected = false; //Clear the selection ddl.options[1].selected = trueMAKMark as Answer if this reply helps youMVP ASP/ASP.NetASP.Net Hosting : Host DepotMy Sit...

Web resources about - About dropdown list selected item and selected value - asp.net.getting-started

How to convert unordered list into nicely styled <select> dropdown using jquery?
$('ul.selectdropdown').each(function(){ var select=$(document.createElement('select').insertBefore($(this).hide(); $('>li a', this).each(function(){ ...

Credit Suisse Reiterates On Enbridge Energy Partners, L.P. Following Alberta Dropdown
In a report published Thursday, Credit Suisse analyst John Edwards reiterated an Outperform rating on Enbridge Energy Partners, L.P. (NYSE: EEP), ...

Convert a Menu to a Dropdown for Small Screens
Create a menu that, on smaller screens, changes into a dropdown menu. A dropdown takes up much less screen real estate and can be easier to use. ...

Office-Add-in-Fabric-UI-Sample/Dropdown-demos.html at master · OfficeDev/Office-Add-in-Fabric-UI-Sample ...
Contribute to Office-Add-in-Fabric-UI-Sample development by creating an account on GitHub.

Google Adds Dropdown Menu to Search Results, Hides Cached Pages Inside
Google recently updated their search results format, again moving the link for cached page access somewhere else. Now it hides in a convenient ...

50+ Awesome jQuery Dropdown Menu Tutorials
When designing graphical user interfaces, many people prefer to use a dropdown menu as a GUI element. This allows the user to choose a value ...

Sign out command in dropdown
We can save some space in the menus by putting the Sign-out command in the dropdown menu. As we're building the menu, if I see a command called ...

Google toys with removing Instant Preview in Search, adds dropdown menu with Cached, Similar, Share options ...
Google has added a new drop-down menu to its search results page beside every URL with three options: Cached, Similar, and Share. At the same ...

Facebook Fan Page Changes You Haven’t Heard About
... fashion appears at the top center of the page if you scroll down to the cover image or any point lower. A box labeled highlights has a dropdown ...

Edit Companies - Eric Feng - CrunchBase Person Profile
If this person is an investor, please only submit companies for which he/she has a functional role (like Board, Advisor, etc). Click 'Past?' ...

Resources last updated: 12/3/2015 5:35:47 AM