.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Setting SelectedValue for ComboBox

Posted By: Asim Sajjad     Posted Date: August 06, 2011    Points: 2   Category :Silverlight
When you add combobox items inside xaml then SelectedValue of the Combo Box didn't work.

View Complete Post

More Related Resource Links

Combobox SelectedValue with Converter and PropertyChangedCallback() is not working together?

Hi, I have a combobox, I want to have a PropertyChangedCallback and at the same time I want to bind selected value with IsEnable property of a Checkbox. Problem is when I add Converter Neither Converter gets called and nor the  PropertyChangedCallbac().   <ComboBox ItemsSource="{Binding Source={StaticResource EnumExportType}}" Name="CB_ExpType" SelectedValue="{Binding Path=ExpType, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" /> Combobox is binded with static Enum resource EnumExportType. Selected value is Binded with a Dependency Property ExpType which is a Enum.   public ExportType ExpType { get { return (ExportType)GetValue(ExpTypeProperty); } set { SetValue(ExpTypeProperty, value); } } public static readonly DependencyProperty ExpTypeProperty = DependencyProperty.Register("ExpType", typeof(ExportType), typeof(ExportScreen), new FrameworkPropertyMetadata(ExportType.EntireProject, new PropertyChangedCallback(ExportTypeChanged))); this works fine On changing Item from combobox PropertyChangeCallback gets called. Now I want To bind the IsEnabled property of a Checkbox to the ExpType property and I use IValueConverter to convert the ExpType to the correct boolean value. <CheckBox Content="Test" Name="CHK_WithModels" IsEnabled="{Binding ElementName=CB_ExpTyp

DropDownList SelectedIndexChanged event not fired when programatically setting SelectedValue


In our asp.net web application we load the dropdown list boxes in the page load.  We than set the SelectedValue of each dropdown list box to an object from session.  We have event handlers for many of the SelectedIndexChanged events of the drop down lists boxes, but these do not get executed when we set the selected value programmatically.


Someone else mentioned this is by design, and only when a user manually changes the drop down list selected index, will the event get raised.


I would think this is a common scenario of wanting the selectedindexchanged event handled when setting the selectedvalue/selectedindex/listitem's selected property, of a DropDownList.  What is the suggested way to handle this?  Is there a significant drawback of creating a custom control inherited from DropDownList that has the functionality of raising this event when changing the SelectedIndex or SelectedValue?



ComboBox SelectedValue too slow


DataBound ComboBox bound to DataTable of 2 columns with 1000 items (ZIP codes) is too slow when current selection is changed via SelectedValue. It tooks even 300ms on my i3 4GB W7 64bit.
In case of form with 10 combos on detail UI becames unusable in master/detail scenario.

If I implemented some FindRow method and current item is selected via SelectedIndex it works fine (at least it tooks 10-times less time).

Every possible change events are blocked during call of SelectedValues.

Any ideas how to correct this issue?

Thanks in advance.

VS2010, .NET 40


Ondrej Spilka

Setting the default start page in godaddy hosting?


 How do you set the start page with godaddy hosting? I can see no way of doing this! You do not seem to have access to the IIS settings that allow you to change it!

Setting Screen Resolution



  I am developing a website in asp.net.How can i make my web pages view same in different screen resolutions.I am using 1024*768 resolution

Error while setting up application on Win7 using Visual Studio.NET 2003


Hi All,

Getting the below error while setting up application on Win 7 using visual studio.NET 2003.


cannot find the components for communiacting with the front page server extensions...


I understand by the error, i need to install Front page server extension, but not able to figure how to install using IIS 7.5.

I had XP machine with IIS 5.1, able to find the option.


Need your help in resolving this.




Setting default localization



I ever thought that I can set a default localization if the users one (which is set in the browser) isn't available.

I've implemented my localresource files for localization. The start.aspx.resx contains all texts and elements for German use and the start.aspx.en.resx for English users. When I switch the language in the browser settings from German to English everything works fine and the english text is displayed. But when I switch to an other language which is not German or English, it takes defaulty the german resource files.

I've set

UICulture="auto:en-US" Culture="auto:en-US"

as well, but it didn't assume the .en resource file automatically. (For example when I enter the website and switch the browser language to French or Italian it should take the english resource files.)

Thanks and regards,

How to display related tables in one crystal report and how to link this report with combobox?


Hi! I want to display a crystal report in my vb.net application. Suppose I have tables named student details, student marks, student address, etc... Now if I want to display all these details (fields of all tables) in one crystal report (with page breaks if necessary) then how will I achieve it. I will be providing a combo box in my application that contains list of student names. How can I link this combo box with the cystal report to dynamically display report for different student on selected index change of combo box? Help me friends. An example would be appreciable.

C++ at Work: Addin a Combobox Cancel Feature


This month Paul DiLascia codes some Microsoft Office-style dialog box features.

Paul DiLascia

MSDN Magazine August 2006

Advanced Basics: Setting Word Document Properties the Office 2007 Way


The last time I wrote this column (March 2006), I shared an application that allows you to update all the Microsoft® Word documents in a folder and its subfolders. Each time the application finds a document in the specified path, it updates the document properties to match those you specified in the application.

Ken Getz

MSDN Magazine June 2006

ActiveX and Visual Basic: Enhance the Display of Long Text Strings in a Combobox or Listbox


The combobox and listbox controls in Visual Basic have no built-in support for displaying text strings that are too long to fit in the visible area of either control. This article describes several techniques to improve the readability of long strings in each control. The first technique uses tooltips to display a combobox or listbox item. The other techniques, which use various Windows APIs, include adding a horizontal scrollbar for a listbox and determining the necessary width of the longest string given the font attributes of the text. The required steps are described for both comboboxes and listboxes.

John Calvert

MSDN Magazine December 2000

Setting webpage/masterpage background...image?


I want to have the background of my masterpage (the master page for all of my .aspx pages) have a sort of gradient.  I imagine the only way I can do that is with an image.  Or maybe even some other design, but I want to move away from the "solid color" background.

Is the easiest way to do this just to make an image and set that as the background?  What image size should I make it, because some users could possibly have the normal aspect ratio, or maybe a widescreen?  What should I make it like so that it looks good on all computers?

Thanks in advance. :) 

setting scroll position for a ListBox


I have a ListBox control showing 10 rows.  I have 30 rows total in the listbox.  How do I programmatically adjust the scroll to show the last ten rows?

Some sources have suggested that I set the SelectedItem.  But I am already making selections (myListBox.Items[28].Selected = true, myListBox.Items[29].Selected = true, etc); the listbox scroll is positioned on Item[0] not the first selected item.  I have also tried setting myListBox.SelectedItem in addition to the multiple selection just mentioned but that does not have any affect either.


unable to attach database, security setting?


Hi folks,

I am using VS 2010 Professional with SQL Server 2008 Developer.  I right click on the App_Data folder in solution explorer and add an existing item, then navigate to the correct database.  However, I receive a pop up that Access is Denied.  How do I fix this? 

JSON Deserialize into Entity Framework Object and setting the DataMemberAttribute "Name="




I'm in the process of deserializing a JSON object into an Entity Framework object.  The property names in the JSON do not match up totally with the property names in the Entity Framework Objects. What I'd like to do is set "Name=" on the  "DataContractAttribute" for the table and the "DataMemberAttribute" for the properties in the Designer.cs file.  I tried setting these in the Designer.cs file manually just to see if it would work - which it did (using JSON.Net) but of course when I went into the .edmx designer I lost all my changes.  Is there a way to do this?


Thanks in advance

Setting accessibility mode for multiple web applications


We have a SharePoint farm consisting of 5 web applications. These are tied together through branding and a custom sitemapprovider which present the farm as a single environment to end users. Our visually disabled users however have to enable the accessibility mode for each web application. Which is a nuisance, ideally they would only have to enable once for the complete farm. Does anybody have a solution for this problem.

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend