w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
ASP.Net ListBox items to get in code behind which are added using jQuery
Hidden fields will be the silver bullets here. step1. add a asp hiddenfield to your page lets say hf1 is its id. step2. add a clientclick event to your save button step3.in the client clickevent get all personal skill and make them into a single string using comma or '|' step4. set the hf1 value to the string generated by step3 and then post it. step 5.On the server side get the value of the hf1 which will be the same string generated in 3rd step. step6. deserialize it and //do any thing you want. hope this help

Categories : C#

This code to remove listbox duplicate items gives me an error
I think it would probably be easier to just copy the list first, then put the unique results back: Dim items(GlinkList.Items.Count - 1) As Object GlinkList.Items.CopyTo(items, 0) GlinkList.Items.Clear() GlinkList.Items.AddRange(items.AsEnumerable().Distinct().ToArray())

Categories : Vb.Net

Knockout -how to transfer multiselect listbox items(any orde selected items) to another listbox using Knockout?
Just use two observableArrays for available options of both selects. From one .remove(item) and .push(item) to the other. Knockout will track changes. Try an event or click binding. Or put this function in computed observable watching selected items. You didn't made a sample jsfiddle to help you some more with example.

Categories : Knockout Js

Why I always get the first selected value from a ListBox when I call ListBox.SelectedValue and select items in ASC order inC#?
Try using SelectedItem instead: private void lstEquipos_SelectedIndexChanged(object sender, EventArgs e) { // Get the currently selected item in the list box string currentItem = lstEquipos.SelectedItem.ToString(); // Find the index of the currently selected item in the list box int index = lstEquipos.FindString(cucurrentItemItem); textBox1.Text = index.ToString(); }

Categories : C#

ListBox displays "System.Windows.Forms.ListBox.Items.Count..."
To write the items, change the line that does the write to: rollLog.WriteLine(lstBoxOut.items[count]); To read it back in: private void btnReadFile(object sender, EventArgs e) { lstBoxOut.Items.Clear(); foreach (string line in File.ReadLines("Roll Results.txt")) { lstBoxOut.Items.Add(line); } } The reason you're getting that output "System.Windows.Forms.ListBox...." is because the statement rollLog.WriteLine(lstBoxOut) is equivalent to rollLog.WriteLine(lstBoxOut.ToString()). The ToString() method returns A string that states the control type, the count of items in the ListBox control, and the Text property of the first item in the ListBox, if the count is not 0.

Categories : C#

Align Listbox, Button and Labels side by side
Your figure shows the controls mis-aligned. If you want them aligned, eg Button on the same "line" as label2, I'd place all of them in a 5x3 table. If you don't want them aligned, place them in a generic div, and add classes to them. Then in the css, set the div to position:relative, and position: absolute the elements as you want.

Categories : C#

Hide items in a ListBox when ListBox is disabled
Just add another ListBox to the form and when you disable the first listbox with the elements inside of it, hide it, and then display the other to the user which will essentially be an empty greyed out listbox. Then when you enable the box back, hide the empty one and show the real one. Hope this helps.

Categories : C#

Are there anyway to make ListBox items to word wrap if string width is higher than ListBox width?
Helpful link Check out this answer. It overrides the template of the listbox with a textblock which wraps the text. Hope it's useful. To solve your problem I think you shold add : ScrollViewer.HorizontalScrollBarVisibility="Disabled" . Found it here

Categories : C#

REST API and clients - removing previously seen items - client-side or server-side?
First off, if the requirement is to not show a user products they've seen before on any device/platform (for example if they used the app on their iphone then ipad/ipod) then you'd definitely have to do it server side (as the app cannot know what the user has seen on other devices unless you are storing it on the server). Assuming, it is a device specific requirement, I would think your goal would be to minimize (potentially unreliable or slow) network traffic to optimize the iphone experience. Syncing back and forth with the server will require extra network traffic, which may fail at times. Which would lead to a conclusion of client side storage. Unless your users are going to be seeing some huge number of products that would chew up disk space, but I assume the amount of data you store

Categories : IOS

Events raised in .net code is does not seem to occur in COM code when deployed with Side by side manifests
After a long time (and several failed attempts) It turned out I could make this work by making one tiny change: Make the VB6 code compile to P-Code instead of native code. I'm pretty sure this somehow affects how marshalling between threads is handles, but I've been unable to find any information confirming that theory. At least it works... Or Not! (24. October 2013) It turned out that in real life compiling to P-Code was not enough. In another implementation of this pattern we ended up with the event just disappearing into nowhere, with no exceptions (we thought) and no traces. So more investigation was due: 1. The real issue Wrapping the event triggering in a try-catch clause revealed that there was in fact an exception being thrown, it just never surfaced anywhere if (OnHappened

Categories : C#

Moving checked items to the top after unchecking all items
in JS var list = $("ul"); var html=$("ul").html(); sortItems(list); var anch = $('#clear'); list.on('click',"a",function(){ var list = $("ul"); //$(this).parents().eq(0).find(':checkbox').removeAttr('checked'); $("ul").html(html); sortItems(list); }); function sortItems(list){ origOrder = list.children(); list.on("click", ":checkbox", function() { var i, checked = document.createDocumentFragment(), unchecked = document.createDocumentFragment(); for (i = 2; i < origOrder.length; i++) { if (origOrder[i].getElementsByTagName("input")[0].checked) { checked.appendChild(origOrder[i]); } else { unchecked.appendChild(origOrder[i]);

Categories : Javascript

Add items from 2 listBox to one listBox
For first part: listbox3.items.add(listbox1.SelectedItem.ToString() + listbox2.SelectedItem.ToString()); For second part: WebRequest request = WebRequest.Create(listBox1.SelectedItem.ToString() + listBox2.SelectedItem.ToString()); Final phase: If exception occurs and different url is expected then do select different url entries from both listbox1 and listbox2 and click the button to check. Also keep correct entries in both the listboxes to avoid exception.

Categories : C#

Moving a WordPress side bar
You could try setting the z-index of the widget area higher so that it layers over the top of the page and therefore shouldn't effect other elements when it is moved in terms of its position. .classForWidget{ z-index:999; } Set that on there and it should help, this is assuming that you are altering the size/position of the widget on the live page, as in an adjustable div etc.

Categories : Wordpress

How to add items to the other ListBox in VB?
Your problem is, probably, in trying to access the second form directly. To access it from the first form declare a new second form, 'Dim Sec as New Second'. Now you can access all the controls in the second form, from the first. Then use 'Sec.Show()' to show the form. Also what is the datasource of the listbox in the second form?

Categories : Vb.Net

WPF Listbox Items
You may want to explore an MVVM approach. In one of your view model classes, you can have an ObservableCollection<string>: public ObservableCollection<string> StuffForListBox { get; set; } Populate that ObservableCollection with what you want to get displayed in the ListBox. In the code-behind of the UserControl or Window in which you have the ListBox, set the DataContext to an instance of the class containing StuffForListBox seen above. this.DataContext = new MyClass(); Alternatively you could also create a datatemplate for the usercontrol / window which will automagically wire up the datacontext with your view model. Since you only mentioned that you want to display the files in a directory (not including sub-directories), you just need to bind the ItemsSource to St

Categories : Wpf

Crop and upload image on client-side without server-side code involve
The solution i used: First I use a 3rd party javascript library to select the crop area like jCrop. Once i got the coordinates (x1,x2,y1,y2), i draw a copy of an image to a canvas. var canvas = document.getElementById('drawcanvas'); var context = canvas.getContext('2d'); canvas.width = canvas.width; // clear canvas var imageObj = new Image(); imageObj.onload = function() { // draw cropped image // ... context.drawImage(imageObj, sourceX, sourceY, sourceWidth, sourceHeight, destX, destY, sourceWidth, sourceHeight); var dataURL = canvas.toDataURL(); }; imageObj.src = // image url After i drew the canvas, i converted the canvas to a DataURL which is in base64 format. On

Categories : Javascript

Moving XML parsing to server-side
you can use Cxml for parsing xml in C++ http://libxmlplusplus.sourceforge.net/docs/manual/html/ar01s02.html#id2504579 http://www.codeproject.com/Articles/111243/Simple-C-XML-Parser Once your xml is parsed you can use GetRootNode(), GetNextChild() to traverse through the xml file

Categories : Javascript

Android Fragments: Sharing Code with Dual UIs (stack-of-cards phone and side-by-side tablet)
If your "add" button is in the detail fragment, there is no reason to handle the click event in the activity. I think you should put the click event handling in your detail fragment. Why do you want to keep all database access in the activity ? Make sure you're properly abstracting database access ( using a ContentProvider for example ) and don't be shy to use your abstraction wherever it makes sense. Adding an item using a ContentProvider should be as simple as: getContentResolver().insert(myUri, myNewItemContentValues); It you need to display a dialog, just get a reference to the current activity from the detail fragment, and use it to display your dialog. If several fragments share the same functionality, you may need to write a simple helper class with some methods like: public

Categories : Android

More highlighted items in a listbox
To avoid this you'll have to use a wrapper around your strings; your Picture objects seems a good start. Here is a sample that illustrates the two approaches: XAML: <Window x:Class="WpfApplication1.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525" xmlns:local="clr-namespace:WpfApplication1"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="*" /> </Gr

Categories : C#

Add multiple items in a listbox row
See the example from the MSDN ItemsControl.ItemTemplate <ListBox Width="400" Margin="10" ItemsSource="{Binding Source={StaticResource myTodoList}}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text="{Binding Path=TaskName}" /> <TextBlock Text="{Binding Path=Description}"/> <TextBlock Text="{Binding Path=Priority}"/> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> </ListBox> It should be pretty straight forward to match with your example.

Categories : C#

Select items from Listbox, one by one
Do what you want to do but i don't understand why you need to select an item form listbox. but you can get the items by listBox1.Items[i] and then can calculate the size. Use below code to do that what you wanted. for (int i = 0; i < listBox1.Items.Count; i++) { listBox1.SelectedItem = listBox1.Items[i]; //Calculate the total size of items present in listbox here }

Categories : C#

Not able to return items in listbox
Since you're adding the options with JS, your server doesn't know this. When you post the values back, they didn't exist at run-time so it grabs the original count (1). You'll have to use another method to get the newly added values, example: add them to a hidden field with runat='server' and grab the values from that.

Categories : Javascript

In ListBox cannot add Items after ItemSource is set to null
The two-way binding on ListBox2.ItemsSource sets ListBox1.ItemsSource to null when ListBox2.ItemsSource is set to null. Subsequently, the two-way binding on ListBox1.ItemsSource also sets Coll to null. Don't make the ItemsSource bindings two-way. It is not necessary, and collection changes will still be notified. <ListBox x:Name="ListBox1" ItemsSource="{Binding Coll}" ... > ... </ListBox> <ListBox x:Name="ListBox2" ItemsSource="{Binding Path=ItemsSource, ElementName=ListBox1}" ... > ... </ListBox> It's not really clear what you are going to achieve, but it may be better to also bind ListBox2.ItemsSource directly to the Coll property.

Categories : Wpf

Items doesn't appear in ListBox in C#, but in XAML yes
I think it's because the ListBox1.Items collection does not implement the INotifyPropertyChanged/INotifyCollectionChanged. You could create an observable collection an assign it to the ItemSource. ObservableCollection<MyData> items = new ObservableCollection() items.Add(new MyData()); ListBox1.ItemSource = items; The reason you don't see it added, is that the listbox is already created/filled and the collection of Items does not notify the listbox when you call the .Add method on the Items property.

Categories : C#

Highlight multiple items in listbox
Guess you need something like this: <ControlTemplate TargetType="ListBoxItem"> <TextBlock Text="{Binding LastOperation}"> <TextBlock.Style> <Style TargetType="TextBlock"> <Style.Triggers> <DataTrigger> <DataTrigger.Binding> <MultiBinding> <Binding Path="MouseOverIndex"/> <Binding Path="CurrentIndex"/> </MultiBinding> </DataTrigger.Binding> <Setter Property="Foreground" Value="Gold"/> </DataTrigger> </Style.Triggers>

Categories : C#

ListBox items changes based on condition
use a value converter. see some samples here Create a converter class public class PurchaseStatusConverter : IValueConverter { private const double comparePrice = 2000; public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { double price; if (double.TryParse(value.ToString(), out price)) { return price > comparePrice ? "Purchased" : "Not Purchased"; } return "-"; } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { throw new NotImplementedException(); } } In your app.xaml, define the converter, take care of namespaces, re-sharper should handle this for you if you have

Categories : Json

Accessing ItemsPresenter items in a ListBox
If container is not created (i.e., it is out of viewport bounds), you have to get the ScrollViewer which is the ListBox template child and then call the ScrollToHorisontalOffset method to create containers for items. After that you should also call the UpdateLayout to force container generation - here you can acces newly created container. Note that in has no correct value for RenderSize, but you can measure element and get its DesiredSize. Note that ContainerFromItem can return null if your listbox is collapsed or container generation is not started (or not finished) - check the ItemContainerGenerator.Status property.

Categories : C#

how to add user controls as listbox items
You can set ItemTemplate for the listbox with your usercontrol in it. <ListBox> <ListBox.ItemTemplate> <DataTemplate> <local:UserControl1/> </DataTemplate> </ListBox.ItemTemplate> </ListBox> Thanks

Categories : C#

How to export listbox items into XML file
Try the above var xml = new XElement("Items", from s in strings let parts = s.Split('=') select new XElement("Item", new XAttribute("Key", parts[0]), parts[1] ) );

Categories : C#

How to synchronize listbox items in two forms?
The easiest (and best) way is to bind both the ListBoxes' (even 3, 4 or more) DataSource to the same one. We have to use BindingList<> instead of List to benefit the capability of notifying changes in collection. BindingList<object> listData = new BindingList<object>(); listBox1.DataSource = listData; public void ShowForm2(){ ListBox list = new ListBox(); list.DataSource = listData; Form f = new Form() { BindingContext = this.BindingContext };//Set BindingContext the same to synchronize tracking item in both listBoxes. list.Parent = f; f.Show(); } //This is used to add new item to the source public void AddItem(object item){ listData.Add(item); } //This is used to remove an item from the source public void RemoveItem(object item){ listData.Remove(item);

Categories : C#

WPF XAML WrapPanel ListBox items in a row
The problem is that your WrapPanel only has a single child: The ListBox. This means that the layouting is done by the ItemsPanel template of the ListBox. Try this instead: <Expander Header="{Binding GroupName}" Style="{DynamicResource FeatureExpander2}"> <ListBox x:Name="ListOfTiles" ItemsSource="{Binding VideoSamples}"> <ListBox.ItemTemplate> <DataTemplate> <StackPanel Width="120" Margin="10" HorizontalAlignment="Left"> <Image /> <TextBlock /> </StackPanel> </DataTemplate> </ListBox.ItemTemplate> <ListBox.ItemsPanel> <ItemsPanelTemplate> <WrapPanel /> </ItemsPanelTemplate&

Categories : Wpf

Exception while Refresh-ing Items of ListBox
It would be better to maintain your own list separate from the Dictionary and copy values over when the Dictionary changes. I'd advise using an ObservableCollection, so you don't have to do a refresh call. I swear I still have my code for an ObservableDictionary somewhere.

Categories : C#

c# and wpf crisis with blank listbox items
FoodInformation class does not contains properties: Image and Name (you are trying binding to these properties in DataTemplate). From code-behind we can create definition of FoodInformation class with properties Dinner and DinnerImage: class FoodInformation { public string Dinner { get; set; } public ImageSource DinnerImage { get; set; } } So you should binding to properties Dinner and DinnerImage, not to Image and Name. If you change in DataTemplate appropriate properties names everything will be ok. <DataTemplate x:Key="templateListBoxItem"> <Grid Margin="5"> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"></ColumnDefinition> <ColumnDefinition Width="*"></ColumnDefinition> </Gri

Categories : C#

Listbox items dont want to stretch
Note, you don't need to set the Horrizontal alignment setting to stretch unless it's in a container that overrides it. By default most XAML controls are set to take up the most space. Also check that your margins are not shrinking your containers below where you want them. (note you can use negative margins to stretch as well)

Categories : Dotnet

C# - remove part of listbox items
Understanding from your comment you only need the filename of the files, without the path or the extension. For that you can use Path.GetFileNameWithoutExtension string[] songspaths = System.IO.Directory.GetFiles(librarypath + "/" + albumpath + "/" + songpath); // Get all the files from the specified directory List<string> listsongs = new List<string>(); foreach (var f in songspaths) { lstSong.Items.Add(Path.GetFileNameWithoutExtension(f)); // Store the filename without path or extension in the list } And to explain the code your friend has wrote: string songs = f.Split('\').Last(); The string.Split method diviedes the string into an array of substrings delimited by the given character. In this case it's an (escaped) backslash. The .Last() returns the last element

Categories : C#

How to copy Items from Datagrid to Listbox
If you want the instance of the object to enter the listbox, you cannot control the tostring method like you do: lstSelected.Items.Add(iFacilitiesDataGrid.SelectedItem.ToString()); Instead, cast your selecteditem to the type: lstSelected.Items.Add((HM.IFacility)iFacilitiesDataGrid.SelectedItem); If you don't want the object to enter the listbox, but just some properties from that object, then you have to override the tostring in your object. If you don't do that, the tostring will give you the type of the object, like you said --> "HM.IFacility" to override the tostring, put this in your object class: public override string ToString() { return property1 + " " + property2 } Where property1 and property2 are properties on your object class (like name, age, or id)

Categories : Wpf

How can I bind to all items in a wpf ListBox and specify a converter?
I think you just need to add the element name to point it back to the listbox, (assuming that's what you are trying to do) FontStyle="{Binding ElementName=listViewTakeOffConfigurations, Path=SelectedItem, Converter={StaticResource estimatingTakeOffConfigurationToFontStyleConverter}, Mode=OneWay}"

Categories : Wpf

Sending all items to textbox from listbox in vb?
To do something like that, you need to loop through all of the items in the list and combine them all into a single string. Then you can display the formatted string in the text box. The best way to continuously append to a string is to use the StringBuilder class, like this: Dim builder As New StringBuilder() For Each i As Object In ListBox1.Items builder.AppendLine(i.ToString()) Next TextBox1.Text = builder.ToString()

Categories : Vb.Net

Adding concatenated strings as listbox items
Just build your string before you add it to the ListBox. string text = textBox1.Text + "hrs, " + textBox2.Text + "min, " + textBox3.Text + "sec."; if (checkBox1.Checked) text += " Novelty: " + textBox4.Text; listBox1.Items.Add(text);

Categories : C#

c# copy selected listbox items into a string
You're always setting myval to current value of dep.ToString - you should concatenate it (I think you meant arr not dep): myval += arr.ToString() + ", "; The easiest way to deal with the commas is to create additional list and use String.Join: var selected = new List<string>(); foreach (var arr in listboxName.SelectedItems) { selected.Add(arr.ToString()); } string finalStr = "some text before the values" + String.Join(", ", selected);

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.