selectedvalue

Trouble with selected radiobuttonlist value on postback vb.net

I have a radio button list on a page that is used to configure products. when the page loads the first time the first list of options is displayed. you select one of them then click a "Next Step" button and the page posts back and shows a new radio button list for step 2. Now if i click a "Previous Step" button i can easily get the previ...

Binding a ComboBox to an IList and using SelectedValue

I have a ComboBox set up as follows, where KVPList is an IList (of KeyValuePair if it matters): comboBox.DisplayMember = "Value"; comboBox.ValueMember = "Key"; comboBox.DataSource = KVPList; I then have set up a binding with SelectedValue, binding to a BindingSource (to a DataSet). For whatever reason, the combo box always turns up bl...

Combobox doesn't bind correctly to SelectedItem

I have two projects. One is working and the other isn't however the differences between them is nothing that I think "should" be of any importance. The first project is the one that is broken and it is the one I am trying to fix. The second project is a little sample project that I created when the first project just won't work at all. O...

ASP:DropDownList in ItemTemplate: Why is SelectedValue attribute allowed?

This piece of code <asp:DropDownList runat="server" ID="testdropdown" SelectedValue="2"> <asp:ListItem Text="1" Value="1"></asp:ListItem> <asp:ListItem Text="2" Value="2"></asp:ListItem> <asp:ListItem Text="3" Value="3"></asp:ListItem> </asp:DropDownList> yields this error: The 'SelectedValue' property cannot be set ...

Populating Nested Repeater Drop Downs C# .NET Linq

I have nested repeaters that create a table with each cell consisting of 3 drop downs. I set the selected value of the drop downs by looping through the repeaters and assigning them to the result of a linq statement. The number and characteristic drop downs work fine, but the make drop downs all get set to the last value assigned. Doe...

Implement SelectedValues property on WPF control

I'm working on creating a CheckedComboBox WPF control. I want to add a SelectedValuesProperty that I could bind through via XAML. I've tried a few different things and haven't been able to get it to work yet. Does anyone have any suggestions on how to approach this? My control inherits from MultiSelector. Thanks in advance! This is ...

WPF: SelectedValue always null

In the following example SelectedValue of TabControl is always null. Why? <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib"> <DockPanel> <TextBlock Text="{Binding SelectedValue, ElementName=Tabs}" DockPanel.Do...

Bind WPF ComboBox SelectedValue-property to multiple objects

Let's say I have a list of Customers (List) and each Customer has a State-property. Is it possible to bind the SelectedValue of a ComboBox, so that it shows (has a SelectedValue of) e.g. "WA" if all Customers have WA as their State? If the customers have different State-values nothing is shown. But if I then choose OR, then all Custome...

How to get selected value after clone with jQuery?

Here is my complete testing code,which failed to get the value: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> <m...

SelectedValue which is invalid because it does not exist in the list of items

I encounter this problem repeatedly, and haven't a clue what is causing it. I get an exception in the DataBind: "SelectedValue which is invalid because it does not exist in the list of items". Here are some important pieces of information: 1) I reload listOrgs periodically when the underlying data has changed. 2) The Organization.DTList...

How to set one of the values in dropdownlist as selectedvalue in asp.net mvc?

I have a dropdownlist with values -1,1,2 and text A,B,C i wanna set B as selectedValue by default when the page is loaded. Something which can be done at the Page Level i.e in aspx or ascx. ...

SelectedValue not binding for some of the Html.dropdownlist in asp.net mvc???

I got 3 html.dropdownlists out of which only for 1 its the setting the selectedvalue.How come its binding for one of the dropdownlist not for the other 2.In the Quick Watch,all the values are proper, it even shows which value has its selected=true. but in the page it doesnt get set. Is there any solution for this? Function Index(ByVal c...

.Net ComboBox Binding Issue

I have 2 comboboxes, each are bound to the the same DataTable like so: channelTypeCB.DataSource = SynergyData.ds.Tables["ChannelTypes"]; channelTypeCB.DisplayMember = "channelType"; channelTypeCB.ValueMember = "channelTypeID"; channelTypeCB.BindingContext = new BindingContext(); newSKChanTypeCB.DataSource = SynergyD...

Custom SelectedValue attribute

I am creating a completely custom (only inherits from WebControl) combobox/dropdownlist search control with autoComplete capabilities. JQuery handles assigning the onhover and onclick events for list items (divs with strings in them) and handles the web service call for getting the list of items for the matching text. The server hand...

Getting SelectedValue back from a DropDown in ASP.NET MVC (C#) using Entity Framework

Sorry if this is a repeated question, I scanned the related questions and didn't see anything obvious. I'm using an EditModel with an Entity object, along with two SelectLists in it. The problem is, once I reach my POST action, the SelectedValues for both drop downs are still the same default values I set in the constructor for the mode...

Setting the value of a dropdown list when a page loads

Hi and thanks for your help, I am trying to set the value of a dropdown box when my page loads. Right now it gives me no errors, but the dang dropdown box isn't set to the value I wanted. Here is my code: <body onLoad="IssuesToReportForm.ReportTo.SelectedValue = '<%=strReportTo%>'"> Is this part of the code my problem? Thanks, Will...

Silverlight AutoCompleteBox SelectedValue(?)

Hi, I need to implement an editable combobox where users can select existing values from the data/tables. It needs to be editable because users can also add new rows to the table by entering new values in the editable combobox, so I put an AutoCompleteBox control into my page but I can't find any sample on how to implement such feature....

How to get the selected value of a dropdown in the MVC View itself

Hi all, I have a drop down in a MVC View, which is some thing like this: Html.DropDownList(id, Range(0,10) .Select(x => new SelectListItem {Text = x, Value = x})) In the view itself, I need the selected value of this drop down. I know that I can access that in a JavaScript, but I am looking for a way to get it...

Odd Binding behavior in WPF

Hello, I will try and explain this as concise as possible. I have 2 objects, the first which we will call object A that has an Id property and the second we will call object B, which has a ParentId property. The obvious relationship is that object B's ParentId is set to an object A's Id property. I am using the MVVM pattern, so on the vi...

Bind SelectedValue of ASP.net DropDownList to custom object

Currently I have a DropDownList inside a FormView, databound to an ObjectDataSource. This is the DropDownList, which has it's own datasource, which returns a List of Departments: <asp:DropDownList ID="DepartmentsList" DataSourceID="DepartmentsListDataSource" DataTextField="Name" SelectedValue='<%# Bind("Department") %>' runat="server" /...