w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Populating an XML "Template" programmatically C#
C# has builtin tools for XML-serialization and -deserialization: http://msdn.microsoft.com/en-us/library/fa420a9y.aspx You simply state: [XmlType("Data")] public class Data { [XmlElement("Title")] public string Title {get; set; } [XmlArray("Comp")] [XmlArrayItem("CompItem")] public List<CompItem> Comp {get; set; } } And: [XmlType("Foo")] public class CompItem { [XmlElement("CompItemConfig")] public string Config {get; set; } } Then you can construct a Data-object by simple C# code. Finally you can turn it into an XML file using the following code: Data data = new Data(...);//create Data object System.Xml.Serialization.XmlSerializer xmls = new System.Xml.Serialization.XmlSerializer(typeof(Data)); System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:m

Categories : C#

Programmatically populating html table cells
if you want to display two lines of 3 cells, you should not put the foreach. On the inside of the second loop, you can make reference directly to the element of your list: for (int i = 0; i < 2; i++) { output.Write("<tr>"); for (int j = 0; j < 3; j++) { output.Write("<td>"); int index; if (i = 0) index = j; else index = j + 3; SPListItem item = coll[index]; int newsID = int.Parse(item.ID.ToString()); ...

Categories : C#

Fields not populating on page load but are populating on action event
It seems to me that catagoryDropDown and applicationDropDown are empty at Page_Load. You need to bind them, or somehow fill them in some Init() method which will be called before Page_Load (or simply fill them on Page_Load before calling populateMostRecentStory)

Categories : C#

Cant get DataValueField with AutoCompleteBox WebForm
From the RadControls for ASP.NET AJAX Documentation, it looks like you need to handle the EntryAdded event, like this: protected void RadAutoCompleteBox1_EntryAdded(object sender, AutoCompleteEntryEventArgs e) { // Label1 is made up here just for example's sake // e.Entry.Text will give you the name selected // e.Entry.Value will give you the ID selected Label1.Text = e.Entry.Value + " was added."; }

Categories : C#

WPF - Filtering a DataCollection with an autocompletebox
From the Name property setter in your viewmodel to which toolkit:AutoCompleteBox.Text is bound, you will have to filter the ObservableCollection backing your Collectionview i,e ItemsSource of your ItemsControl. If you have your Collectionsource with you then you can have filter applied to it like below: ICollectionView _peopleView = CollectionViewSource.GetDefaultView(peoples); _peopleView .Filter = PeopleFilter private bool PeopleFilter(object item) { People people= item as People; return people.Name.Contains( _filterString ); //Here filter string will be your Name prperty value } From Setter of name property you will hav to call _peopleView .Refresh(); to apply the filter Thanks

Categories : Wpf

WPF AutoCompleteBox Popup Background
So I assume there is a style somewhere in the ListBox that is making it turn grey so using the AutoCompleteBoxes ItemContainerStyle property I created the following style: <Style x:Key="ListBoxItemContainerStyle" TargetType="ListBoxItem"> <Setter Property="Background" Value="White" /> <Setter Property="BorderBrush" Value="Transparent" /> <Setter Property="BorderThickness" Value="0" /> <Setter Property="HorizontalAlignment" Value="Stretch" /> </Style> This style now changes my listbox popup background back to white to match the other AutoCompleteBoxes in my control.

Categories : Wpf

WpfToolkit AutoCompleteBox style trigger IsFocused NOT firing
I was unsuccessful in finding an elegant solution to the problem. I ended up inheriting from AutoCompleteBox and performing my logic with the event handlers. public class AutoCompleteTextBox : AutoCompleteBox ... public AutoCompleteTextBox() { // Register the event handler for GotFocus. base.GotFocus += this.AutoCompleteTextBoxGotFocus; // Register the event handler for LostFocus. base.LostFocus += this.AutoCompleteTextBoxLostFocus; } Nothing fancy here. I just made my own type. The only thing I do is wire up the got and lost focused event handlers in the constructor. I'm not sure why but the IsFocused trigger does not pick up these events. Also, if you try to override these: "OnGotFocus" or "OnLostFocus", they don't work either. So the only way I could find if the AutoCo

Categories : Wpf

WP - AutoCompleteBox get list of items with bigger font size
You should be able to just give a custom Item style via ItemContainerStyle by targeting the ListBoxItem like; <Style x:Key="myItemStyle" TargetType="ListBoxItem"> <Setter Property="Background" Value="Khaki" /> <Setter Property="Foreground" Value="DarkSlateGray" /> <Setter Property="Margin" Value="5" /> <Setter Property="FontStyle" Value="Italic" /> <Setter Property="FontSize" Value="14" /><!-- Your Property --> <Setter Property="BorderBrush" Value="DarkGray" /> </Style> <toolkit:AutoCompleteBox ItemContainerStyle="{StaticResource myItemStyle}" /> You could also use BasedOn to inherit the rest of the existing style stuff from the default template into your Style so you would only be changing the FontSi

Categories : C#

How do I prevent keyboard navigation in an AutoCompleteBox from firing the SelectionChanged event?
Not sure if this is what you are wanting to do but I have the following code which only changes the selection when the 'Enter' key is pressed or the mouse is used to select an item from the list (left mouse button clicked). I can arrow up and down the list without issue and only fire the selection changed event when the user presses enter or clicks on the desired entry. Note that I am using the AutoCompleteBox and not the SearchField as you are using. In XAML: <toolkit:AutoCompleteBox Name="OmniSearchTextBox" ItemsSource="{Binding CompanyList}" SelectedItem="{Binding SelectedObject, Mode=TwoWay}" IsTextCompletionEnabled="False" FilterMode="Contains" KeyUp="

Categories : Wpf

Can I create a proper drop down menu list in windows phone, nothing like Picker Box, ListPicker, AutoCompleteBox achieving my objective properly?
The ListPicker has a property ItemCountThreshold. This property allows you to specify when the ListPicker should display the full screen selector. This property defaults to 5. You can change the default to a much high number, but you should take caution with doing this. The ListPicker is meant to mimic controls that are used throughout the core apps (like Settings) of the phone. You'd have a hard time finding built in apps that show more than five items in the "dropdown". When displaying in FullMode, you should specify a FullModeItemTemplate and FullModeHeader. The FullModeHeader should be in all caps

Categories : C#

Add UISearchBar programmatically to a programmatically added UITableView in a normal ViewController
Is your object implementing the delegate methods in UISearchDisplayDelegate? In other words, you have to define what happens when text is entered in the search bar, it does not happen automatically for you.

Categories : Objective C

Auto populating Set
"Cannot get element with index 0".. sets are not indexed based to begin with.. why don't you use LazyList of Employee.. as correctly pointed out by @PavelHoral we don't need to use LazyList as Spring handles it.. a simple List initialization (like new ArrayList()) would do, albeit with the possibility of having spaces(nulls) when user submits non-continuous elements. private List<Employee> employees = new ArrayList<Employee>();

Categories : Java

Populating ComboBoxes VBA
Try this: 'For Access msg.ComboBox1.RowSource = msg.ComboBox1.Rowsource & ";'item'" Update: With ComboBox .AddItem "Option 1" .AddItem "Option 2" .AddItem "Option 3" End With

Categories : Vba

C# MVC populating drop down value from DB
The reason the tables aren't showing up when you do @Html.DropDownListFor(u => u. is that in this case u is the model which you have passed into the view. You need to populate the model with the entries that you wish to display in the drop down list. A good example of this is available at http://www.asp.net/mvc/tutorials/javascript/working-with-the-dropdownlist-box-and-jquery/using-the-dropdownlist-helper-with-aspnet-mvc Update This SO post may also be of use, the OP has provided their code for how they retrieve the entries from the database (see getAllCurrencies() method); MVC populating drop down list from database

Categories : C#

XMLNodeList not populating
To get the namespace working, you need to use XmlNamespaceManager. XmlDocument myDoc = new XmlDocument(); myDoc.Load(@"Form.xml"); XmlNamespaceManager xmlNsMgr = new XmlNamespaceManager(myDoc.NameTable); xmlNsMgr.AddNamespace("my", myDoc.DocumentElement.NamespaceURI); XmlNodeList nl = myDoc.SelectNodes("//my:Attachment", xmlNsMgr); With this, nl will be populated.

Categories : C#

Populating a table in Qt
Well, after a lot of hair pulling, I got what I needed. My first step was to create a Property class. This class has functions to set or get a name string, a type string, a value double and a unit string. Next, I updated the Node class to include functions to add and remove Property object pointers to a QList<Property *>. Also included was a listProperties function that returns all the Property objects from a certain Node. After this, the function to populate the QTableWidget with a certain Node's properties was coded like this: propertiesList = node->listMyProperties(); for (int row = 0; row < propertiesList.size(); ++row) { Property *property = propertiesList.at(row); addRow(); tableWidget->item(row, 0)->setData(Qt::DisplayRole, prop

Categories : C++

C# - Populating Gridview
Not knowing the requested specs, I would suggest using an EditItemTemplate on your GridView and placing a textbox control inside that. Do you have to programatically create your gridview? How about this... <asp:gridview> <columns> <asp:TemplateField HeaderText="..."> <ItemTemplate> <asp:Label ID="lbl_Quantity" runat="server" Text='<%# Eval("PutDateFieldNameHere") %>' </asp:Label> </ItemTemplate> <EditItemTemplate> <asp:Textbox ID="txt_Quantity" runat="server" Text='<%# Eval("DataFieldName") %>'></asp:Textbox> </EditItemTemplate> </asp:TemplateField> <ItemTemplate> <asp:Button ID="btn_Edit" runat="server" CommandName="EditQty" Text="Edit" CommandArgument='<%# ("ItemId") %>' /> </ItemTempl

Categories : C#

Populating a Treeview in wpf
Try this DataSet ds = new DataSet(); // Fill your dataset here ds.Relations.Add("YourRelationName", ds.Tables[0].Columns["ParentColumnName"], ds.Tables[0].Columns["ChildColumnName"]); treeView.ItemsSource = ds.Tables[0].DefaultView; write a HierarchicalDataTemplate for the TreeView and bind it in XAML as <TreeView Name="treeView"> <TreeView.Resources> <DataTemplate x:Key="ChildTemplate"> <TextBlock Text="{Binding NodeText}"></TextBlock> </DataTemplate> </TreeView.Resources> <TreeView.ItemTemplate> <HierarchicalDataTemplate ItemTemplate="{StaticResource ChildTemplate}" ItemsSource="{Binding YourRelationName}" > <TextBlock Text="{Binding

Categories : SQL

NodeList not populating
Your XML structure does not match with what you're code "expects". Your code seems to expect a hierarchical XML input, where each Parser holds data nodes and each data holds first nodes: <Parser id="ADPParser2"> <data type="Sales"> <first record="DEAL-NO" /> </data> <data type="Service"> <first record="RO" /> </data> <data type="Email"> <first record="CONTROL" /> </data> </Parser> However, your XML input is flat: the data and first nodes are direct children of a Parser. Your indentation seems to suggest otherwise (which probably caused this confusion), but it really is equivalent to: <Parser id="ADPParser2"> <data type="Sales" /> <first record="DEAL-N

Categories : Java

Hashmap not populating
You are using the same key "" for at least three .put() !! You have defined : public static final String KEY_PROPNAME = ""; public static final String KEY_KEYWORDS = ""; public static final String KEY_THUMB_URI = ""; And then you populate the Map as : map.put(KEY_PROPNAME, clipDetailsArr[i]); map.put(KEY_KEYWORDS, clipDetailsArr[i + 8]); map.put(KEY_THUMB_URI, clipDetailsArr[i + 9]); As per the Javadoc: If the map previously contained a mapping for the key, the old value is replaced.

Categories : Java

Populating a 3D array of structures in C
A few ways to do this off the top of my head: Have your data be equal to the size of your 3D array. Pad the unused or empty elements with 0s or so other sentinel value so you know it is "not real." This is less space efficient, but makes reading and setting the data as simple as a single fread() call. Use an RLE type scheme where you have a 1 byte where the top bit says if the next run is valid data or empty followed by the number of bytes in the run (up to 127 or 128 if 0 runs are not allowed). If valid data, read that many structures in and directly load them into your grid. If invalid run, skip that many structures or mark them some how as invalid. Advantage being it is pretty space efficient, but slower to read as it will take multiple IO calls. XML data format where you can set

Categories : C

Populating a listview with a database
Your code will return the last entry in the database only (no matter if you loop through the cursor, it will return the last result). You can instead use a SimpleCursorAdapter (Specify columns and TextViews to fill from the columns). Check this sample: String[] columns = new String[] { KEY_ROWID, KEY_NAME, KEY_DATE, KEY_MONTH, KEY_YEAR }; Cursor c = ourDatabase.query(DATABASE_TABLE, columns, null, null, null, null, null); String result = ""; SimpleCursorAdapter adap=new SimpleCursorAdapter (getApplicationContext, /*create layout with 4 TextViews*/, c, new String[] { KEY_ROWID, KEY_NAME, KEY_DATE, KEY_MONTH, KEY_YEAR }, int[] /*ids of the 5 TextViews from the layout part in an int[]*/); Then create a ListView to display your d

Categories : Android

Populating combobox in CodeNameOne
The problem you are facing is that you are creating a Vector<HashTable> so when you are populating the combobox the default renderer takes toString() method from each hashtable. I don't know why you need a hashtable, but that's the problem why you are stuck. Im not familiar with codeNameOne but in swing JComboBox by default uses a renderer wich uses toString() method to display object data. So you can make your own renderer class to customize the view. UPDATE I modify your code and comment code, assuming you are using java 1.5 or above. protected void initComboBoxModel(final ComboBox cmp) { try { String sql = "SELECT * FROM stockinfo"; pst = conn.prepareStatement(sql); rs = pst.executeQuery(); Vector<String> vec = new Vector<String

Categories : Java

Populating jTable using List
I think it happens because you didn't supply the table header. See if this works: Object[] columnNames = {"Name", "Starts", "Ends"}; DefaultTableModel model = new DefaultTableModel(new Object[0][0], columnNames); for (Advertisement adv : advertisements) { Object[] o = new Object[3]; o[0] = adv.getName(); o[1] = adv.getPublication_starts(); o[2] = adv.getPublication_ends(); model.addRow(o); } advertisementList_JT.setModel(model); Another possibility is that advertisements List is empty;

Categories : Java

Populating select option using php
<select name='test1' id='test1'> <option value='1'>1</option> <option value='2'>3</option> <option value='3'>3</option> <option value='4'>4</option> </select> Html <select name='tes2' id='test2'> </select> Ajax $("#test1").on('change',function(){ $.ajax({ url : 'someurl', data: { data }, dataType: 'json', async: false, success: function(res){ //Populate second select } }); });

Categories : PHP

SimpleCursorAdapter is not populating ListView
The TextViews that you have defined in vehical_row.xml: @+id/plate, @+id/hyphen, @+id/model and @+id/driver are all missing the layout_width and the layout_height attributes. These are required. For now, set these attributes as "wrap_content". For example: <TextView android:id="@+id/plate" android:layout_width="wrap_content" android:layout_height="wrap_content" style="@style/vehicleDefaultFont.plate" android:text="@string/label_text_view" /> Do the above for the other three as well. This should work for you.

Categories : Android

Populating Two Dropdownlist on PageLoad
An idea could be get the first value from the GetAllCategory The bind the second dropdown list on page load. public void PopulateDropdownList2(int selectedValue) { DropDownList2.Items.Clear(); DataSet ds = softwareType(selectedValue); if (ds.Tables.Count > 0) { DropDownList2.DataTextField = "identifier"; DropDownList2.DataValueField = "ST_ID"; //Change field to one you want. DropDownList2.DataSource = ds.Tables[0]; DropDownList2.DataBind(); } } call the above function on if (!Page.IsPostBack) { } protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { if (Session["Username"] == null) { Response.Redirect("LoginPage.aspx"); } if (getAccess(Sess

Categories : C#

Populating a form from a table
There are various possible solutions to this. The first one (and simplest) is to write a query in the RowSource property of your form with the appropriate data source, and include a filter field in that query that corresponds to the Id you are filtering: select a.* from [your table] as a where a.[id] = forms!frmYourForm![theControlName] That way, every time you open the form, it will show the appropriate data. The second solution (a little more sophisticated) is to edit the RowSource property on run-time. In the code that opens the form, you can do something like this: strSQL = "select a.* from [your table] as a where a.Id = " & theControlName.Value DoCmd.OpenForm "theDetailedForm" form_theDetailedForm.RowSource = strSQL form_theDetailedForm.Requery Hope this helps you

Categories : Ms Access

Populating a ListView using AsyncTaskLoader
The call to notifyDataSetChanged() won't change the data your adapter is using. You need to update the data the adapter has, then call that method. NotifyDataSetChanged() will only tell the adapter it needs to create it's views, but it does not change the data. You need to handle that yourself. In your adapter add: public void setUsuario(List<Usuario> usuarios) { this.usuarios = usuarios; } Then in onLoadFinished() call the new method, then notifyDataSetChanged(). listView.getAdapter().setUsuario(usuarios); listView.getAdapter().notifiyDataSetChanged();

Categories : Android

Populating ListFragment from JSON
I've used json to populate a listfragment like this: public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { super.onCreate(savedInstanceState); View view = inflater.inflate(R.layout.activity_lista_ordens, null); context = inflater.getContext(); ordemServicoLista = new ArrayList<HashMap<String, String>>(); } Here i execute the method to call webService and put all information in a listAdapter: new CarregaOrdens().execute(); setListAdapter(adapterListaOrdens);

Categories : Android

Populating one combobox from another using ASP.NET and KnockoutJS
I think you may be confused as to how Knockout works, it may help going through the turorials. You seem to be doing two things that go against the idea of KO that are part of your problem: don't directly wire the onchange event like that, but use some Knockout construct (for example a subscription) for that; you seem to be clearing and repopulating the cityArray instead of the cityValue observable array; the UI will only respond to changes in the latter Furthermore, you'll need: a selectedOptions binding to bind an observable to the selected state(s) Some changes I'd at least suggest, in respective order: <select id="stateSelect" style="background-color:#69bed2; width:50px;" data-placeholder="..." data-bind="options: stateValue, selectedOptions: select

Categories : Asp Net

Dictionary not populating correctly
All your dictionary values are references to the one class-attribute regionData. You want to create copies instead: self.worldmap = {(x,y): self.regionData.copy() for x in range(self.mapSize) for y in range (self.mapSize)} This uses the dict.copy() method to create a shallow copy instead; this is enough as the values of Generate_Game_World.regionData are mere strings and these are immutable so are safe to be shared. You could also use a dictionary literal to create a new dictionary from scratch; you don't seem to be using self.regionData anywhere else so inlining is a possibility: self.worldmap = {(x,y): {"Region_Type" : "None", "Region_Level" : 0} for x in range(self.mapSize) for y in range (self.mapSize)} Last but not least, did you mean to use the None singleto

Categories : Python

Populating the NSTableView using ArrayController
You must do some googling before posting any question. Anyways,have a look at these links : How to use NSArrayController to fill data in NSTableView http://daemonconstruction.blogspot.in/2011/11/simple-nstableview-application-with.html http://simplecode.me/2011/07/14/nstableviews-nsarraycontrollers-and-more-bindings/ http://forums.macrumors.com/showthread.php?t=925424

Categories : Objective C

WIX Combobox populating Values
just try this solution: <Control Id="ComboBoxMain" Type="ComboBox" X="10" Y="60" Width="300" Height="17" Property="WIX_VERSIONS" > <ComboBox Property="WIX_VERSIONS"> <ListItem Value="Windows Installer XML 3.0" /> <ListItem Value="Windows Installer XML 3.5" /> <ListItem Value="Windows Installer XML 3.6" /> </ComboBox> </Control>

Categories : Wix

populating JSON to Listview
Android doesn't have a ready-made adapter to populate a ListView with a JSON array, like it does for populating a ListView with database records. I recommend getting comfortable with populating a Java data structure of your choice with the JSON data, and getting comfortable with working with ListViews, populating them from different collections, with different custom rows. Here's a simple example of populating a List from a JSON array, and then using the List to populate a ListView. import java.util.ArrayList; import java.util.List; import org.json.JSONArray; import android.app.Activity; import android.os.Bundle; import android.widget.ArrayAdapter; import android.widget.ListView; public class Main extends Activity { @Override public void o

Categories : Android

populating a text box with FindControl
Firstly , test your function likes TextBox txtAddress = (TextBox)FindControl("tbxReturnAddress"); or You can try likes this , TextBox txtAddress = (TextBox)Page.FindControl("tbxReturnAddress"); Edit If your text-box is in the UpdatePanel , TextBox txtAddress = (TextBox)UpdatePanel1.FindControl("tbxReturnAddress");

Categories : C#

Why is ListView not populating with DataSource?
So, I got it to work. In the XAML, Instead of ItemsSource="{Binding controlsDataSource}", I specified just ItemsSource="{Binding} and then in the MainPage Constructor in the code-behind file, I set the DataContext of the listView control to the Array programmatically. public MainPage() { this.InitializeComponent(); this.controlsDataSource = new ObservableCollection<AllControls.Models.Control>(); this.controlsDataSource.Add(new AllControls.Models.Control("ScrollViewer", "ScrollViewer Desc")); this.controlsDataSource.Add(new AllControls.Models.Control("ScrollViewer", "ScrollViewer Desc")); this.controlsDataSource.Add(new AllControls.Models.Control("ScrollViewer", "ScrollViewer Desc")); listOfControls.Da

Categories : C#

Populating TableView in JavaFX
You need to set the cell value factory to all your columns like this: TableColumn<ObservableList<String>, String> studentIDCol = new TableColumn<>("Student ID"); studentIDCol.setCellValueFactory(new Callback<TableColumn.CellDataFeatures<ObservableList<String>,String>, ObservableValue<String>>() { @Override public ObservableValue<String> call(CellDataFeatures<ObservableList<String>, String> cdf) { return new SimpleStringProperty(cdf.getValue().get(0)); } }); And also I recommend you to extract your query to a service, because the query will block the JavaFX Thread. Check out http://docs.oracle.com/javafx/2/threads/jfxpub-threads.htm Check this full example with test dat

Categories : Java

How to speed up the populating of listview in vb.net
You should keep the: BeginUpdate and the EndUpdate If thats not speeding up things, you should look for a faster SQL server. One little test you could try, is fill the listview with the same number of random items, and skip getting it from SQL. This way you can pinpoint if SQL is the bottleneck... So you get something like; with myLVstyle .beginupdate() for each row as [rowtype] in ds.tables.rows for each col as [coltype] in row.colums dim NewLvi as listviewitem = .items.add(col.itemcoll) next next .endupdate() end with

Categories : Mysql

Prepared statement not populating DB
First, break yourself of the habit of using mysqli_real_escape_string(). The best part of using query parameters is that it's not necessary to do escaping. In fact, you should not, because you'll end up with literal backslash characters in the strings stored in your database. Second, you should always check the return status of prepare() and execute(). If any error occur in parsing or execution, these functions return false. Check for this and then if that has happened, you should look at the error returned. The reason it's important to check for errors is that if the statement fails, you won't know it or the reason why unless you examine the error. Also if you use PHP 5.3, you can use the ?: shortcut to make this code a little more brief. $stmt = $mysqli->prepare("INSERT INTO m

Categories : PHP



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