.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

How to get values setted in custom items from a ListBox

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :WPF



I have a ListBox which looks like that :

Its DataTemplat is :


<DataTemplate x:Key="IndexDataTemplate">
   <StackPanel Margin="0,0,0,5">
    <TextBlock Height="Auto"

View Complete Post

More Related Resource Links

SQL Server 2005: Jazz Up Your Data Using Custom Report Items In SQL Server Reporting Services


Custom report items in SQL Server 2005 Reporting Services address your needs for custom reports without the pain of doing it from scratch.

Teo Lachev

MSDN Magazine October 2006

Deleting items from the index (custom protocol handler)

I created a custom protocol handler. I successfully emit entries into the index. I just can't seem to delete them during an incremental crawl.

I tried:

1. no emitting child item during the enumeration of child entries in a folder
2. returning PRTH_E_OBJ_NOT_FOUND from CreateAccessorEx

doing either 1, 2, or both did nothing. The entries are still there.

what i need to do to delete these entries from the index during an incremental crawl?


How do you create a custom BDC data field that allows for multiple selected values?

I need help creating a custom data field using the BDC column as a base.  We need to allow for multiple selected values instead of just a single one.  I can't find anything on the net which shows how to do this.

jQuery modified ListBox not posting back modified values


Hi everyone,

I have an ASP.Net ListBox that I'm trying to populate via jQuery, using the following snippet:

        $("#MyList_btnAddAll").click(function(e) {
        $('#MyList_lstAll option').appendTo('#MyList_lstSelected');

The code has two ListBoxes in fact, one a "source" and the other a "destination".  As you can tell above the ListBoxes are MyList_lstAll and MyList_lstSelected.  These are rendered in the browser as <select> elements, as you'd expect.

The jQuery is working great, the items are moving from one ListBox to the other, the DOM is updated but when I submit this form (not using jQuery), the ListBoxes don't reflect this change on postback. 

I realize my modifications via jQuery aren't available in ViewState but I thought since the DOM was updated these changes would be part of the postback data?  But in the codebehind after postback the ListBox contents haven't changed.  Does anyone know what might be going on and what I can do about it?  Many thanks.

Giving Custom Colors for Graph values in SSRS2000


Hi All,

        I am stuck here with the color for the graph values i want to give custom colors for each values present in the graph, is it possible in SSRS2000.

 Problem Statement : Suppose if i want to display two data fields as bar graph

                                 Data Fields are : Vegetable Count and Fruits Count

                                          I want Vegetable count to be in Blue Colour and I want Fruits count to be in green colour.

Any help would be appreciated.

Thanks in advance.

Anish Shenoy

How to create a dynamically populated items in a listbox and use it as a navigation?

Hello, I am trying to create navigation inside a listbox menu. I load data from xml to populate a list. Each item in the list box should be a link or button. Then, I create a frame to load xaml pages in it. I tested to load pages employing button control, outside listbox with on click event and it worked well. However, I cannot make it work with list box items. I am hoping to get help from you. Any sample or ideas are highly appreciated. Below is the code:  XML: <?xml version="1.0" encoding="utf-8"?> <Pages> <page id="page01"> <name>Page 01</name> </page> <page id="page02"> <name>Page 02</name> </page> </Pages> C# to initiate a click o n listbox item and get the path to page: private void SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e) { ListBoxItem lbi = ((sender as ListBox).SelectedItem as ListBoxItem); string itemName = lbi.Content.ToString(); if ( Nav_ListBox.SelectedItem.Equals("Page01" ) ) { ContentFrame.Source = new Uri("Pages/Page01.xaml", UriKind.RelativeOrAbsolute); } } XAML:  <ListBox x:Name="Nav_ListBox" Margin="0" ScrollViewer.HorizontalScrollBarVisibility="Hidden" Background="#FFF2F2F2" ItemTemplate="{DynamicReso

How do you add duplicate fields to a SSRS custom report and receive differtent output values.

I have built a custom report in SSRS 2008 using fields for supplier and customer.   I have added a Parent Row Group using the Supplier field for the group expression and used the Customer Details as my child details group. This returns a list of all customers for each supplier.   (Supplier | = Customer details ( Name, Dob etc.)   How would I add an additional Supplier field to the customer details returning only values for other Suppliers used by a customer, not the value of the Supplier listed in the Parent Group?

Custom Sort Values in a Group

Hello, I have a dataset from cube. Please assume the data is similar to below State  Product Sales CA      Bikes    100           Cars     10 MN    Trucks    16 GA    Cars      10        Boats       25   This is represented in a simple tablix and a group is formed on the State. I want to provide a custom sort order on the grouped field lets say i want GA first, followed by CA and then MN. How do i design such a solution? Thank you in advance for your advice.      

Passing values from web page to custom security trimmer in SharePoint 2010

Hi, In SharePoint 2007 we had a custom security trimmer that implemented ISecurityTrimmer interface. We also had a custom webpart used for search. Now, using HttpContext we passed values from the webpart to security trimmer with additional info needed to trim the results. It worked since trimmer was executed in the same w3wp process as webpart. Now in SharePoint 2010, the architecture for ISecurityTrimmer2 has changed, as it's executed in search process (other w3wp) - not the webpart w3wp so it has no access to the HttpContext. Question is: how to pass custom data, in form of the string, to a security trimmer when search is done from custom code in webart?

Custom Validator on DDL&Textbox values

I need to write a 2 custom validators that works as follows: I have a formview (Formview1) with an EditItemTemplate. The validators need to validate values in "DropDownList1" and a textbox called "EndUserGUIDTextBox" If the value in DDL1 is ("Assigned" or "Assigned to End User") and the value of EndUserGUIDTextBox is ("unassigned" or "pending" or NULL) then I need a validator to fire and return {"GUID must be assigned when status is" & DLL1 value}. If the value in DDL1 is ("In Stock" or "In Repair") and EndUserGUIDTextBox is NOT ("unassigned" or "pending" or NULL), then I need a validator to fire and return {"GUID must not be assigned when status is" & DLL1 Value}. The validators needs to run and show in the formview when the UpdateButton in my Formview is clicked. I'm doing this in VB. Real noobie here! All help appreciated. Thanks,

Animate listbox items from ItemTemplate

I want to have a slide-in effect for listbox items, when it's first loaded. I'm using ItemTemplate for listbox items and I coule do the slide-in effect from within the template using RenderTransform and DocubleAnimation. but as the Listbox is vertualized, it does the effect everytime new page of data is loaded in listbox. What I want is to animate the visible items in listbox only when DataContext is changed the first time, like messages list in 'Windows Live Mail' thanks in advance.  

Custom listbox filter

Hi, I'm trying to create a multiselect listbox filter control.  I was using Josh Heyes filters but I'm upgrading to 4.0 and this is no longer compatible.  I have created a new UserControl which inherits from QueryableFilterUserControl, but I can't work out what I need to put into the GetQueryable method.  It's very similar to the ForeignKey filter, it's just that I want the user to be able to select multiple items in the list. Can anyone help? Thanks, Emma

Prevent SQL Injection when using values from a ListBox in the query

Hello,I'm using a List Box to get multiple values that will be used in a query.I can loop over the List Box and create the string.i.e. 'blue','red','purple'The string is used in the query: SELECT * FROM TABLE1 WHERE COLOR IN('blue','red','purple'). Is there a way to parametrize multiple values? @COLOR='blue','red','purple'What will be the best practice to prevent SQL injections in this scenario?

Selecting Items in a databound ListBox

Hi All, I'm facing a problem while trying to programatically preselect few items in a databound ListBox. I have set the datasource of the listbox to a DataTable, with required Data and Value member columns. The selection mode of the listbox is MULTIEXTENDED. Platform: .NET  1.1 (not sure if the problem is relevant to other versions) I tried preselecting items in a different ListBox that is not bound to any datasource. I'm able to preselect items using the SetSelected method. Perfect!   How can I achieve the same for a databound ListBox? What am I missing? Any help will be very much appreciated.   Regards, Amirtha

Reverse Superscript for Listbox Items in C# windows

I want to show Reverse Super script formate for Listbox Items when i check CheckBox using c# windows forms. thanks ram

Custom ListBox Help Needed

Hi,   We have a DataTemplate that includes a ListBox. Each ListBoxItem has some additional functionality provided by a 3rd party diagram component we are using. I need the functionality of the ListBox (selection, key-presses etc) but having this functionality seems to prevent the 3rd party stuff from working. The manufacturer of the 3rd party component suggested creating a custom ListBox with the code below.   public class CustomListBox : ListBox { protected override DependencyObject GetContainerForItemOverride() { return new CustomListBoxItem(); } } public class CustomListBoxItem : ListBoxItem { protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); e.Handled = false; } } This is great for making the 3rd party stuff work again but now we have lost the ListBox functionality (selection, key-presses). Setting e.Handled=true, obviously makes it work as the normal ListBox.   Any help is greatly appreciated.   Neil.      

Custom membership provider not returning values from my web.config


I created a custom membership provider in my ASP.NET 4.0 web site, stored  in App_Code, and referenced in my web.config.

However, it doesn't appear to be pulling values out of web.config during initialization.

The code was taken from http://www.asp.net/general/videos/how-do-i-create-a-custom-membership-provider, and the only modifications were changing "connectionStringName" here to the name of my connection string:

    Dim ConnectionStringSettings As ConnectionStringSettings = _

The connection string always comes back as nothing in this line:

    If ConnectionStringSettings Is Nothing OrElse ConnectionStringSettings.ConnectionString.Trim() = String.Empty Then
      Throw New ProviderException("Connection string cannot be blank.")
    End If

No matter what I change the password format to in web.config, the default value here is always used:

    Dim temp_format As String = config("passwordFormat")
    If temp_format Is Nothing Then
      temp_format = "Has
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