Search Results

Search found 4490 results on 180 pages for 'binding'.

Page 9/180 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • MVC2 Model Binding Enumerables?

    - by blesh
    Okay, so I'm fairly new to model binding in MVC, really, and my question is this: If I have a model with an IEnumerable property, how do I use the HtmlHelper with that so I can submit to an Action that takes that model type. Model Example: public class FooModel { public IEnumerable<SubFoo> SubFoos { get; set; } } public class SubFoo { public string Omg { get; set; } public string Wee { get; set; } } View Snip: <%foreach(var subFoo in Model.SubFoo) { %> <label><%:subfoo.Omg %></label> <%=Html.TextBox("OH_NO_I'M_LOST") %> <%} %>

    Read the article

  • Binding position to ActualHeight

    - by Qanik
    Hi I want to bind a lists position to its own height in XAML. So its lower left corner always will be at 0.0 of the canvas. I'm using elementBinding to get the ActualHeight and a converter to invert the property. But the height sent to the converter is 0. How do I solve this or am I going at this the wrong way? <Canvas x:Name="DisplaySurface"> <ListBox x:Name="MenuList" Visibility="Visible" Canvas.Top="{Binding ElementName=MenuList, Path=ActualHeight, Converter={StaticResource LamdaConv}, ConverterParameter='val=>-val'}"> <ListBoxItem Content="item 1" /> <ListBoxItem Content="item 2" /> <ListBoxItem Content="item 3" /> <ListBoxItem Content="item 4" /> <ListBoxItem Content="item 5" /> <ListBoxItem Content="item 6" /> </ListBox> </Canvas> -Qanik

    Read the article

  • Model Binding an IList of selected items only

    - by jeef3
    I have an action method setup: public ActionResult Delete(IList<Product> products) And a table of products in my view. I have got Model Binding working so that on submit I can populate the products list. But I would like to populate it with only the products that are selected via a checkbox. I think I could do it by changing the action method to this: public ActionResult Delete(IList<Product> products, IList<int> toDelete) And passing the list of check boxes to the toDelete but I would really like to avoid changing the method signature if possible. Is there a way to pass only the selected items? Or am I going to have to write a custom ModelBinder?

    Read the article

  • Java/Swing: the fast/slow UI binding problem

    - by Jason S
    I need a way to bind UI indicators to rapidly-changing values. I have a class NumberCruncher which does a bunch of heavy processing in a critical non-UI thread, thousands of iterations of a loop per second, and some number of those result in changes to a set of parameters I care about. (think of them as a key-value store) I want to display those at a slower rate in the UI thread; 10-20Hz would be fine. How can I add MVC-style notification so that my NumberCruncher code doesn't need to know about the UI code/binding?

    Read the article

  • Google Web Toolkit Deferred Binding Issue

    - by snctln
    I developed a web app using GWT about 2 years ago, since then the application has evolved. In its current state it relies on fetching a single XML file and parsing the information from it. Overall this works great. A requirement of this app is that it needs to be able to be ran from the filesystem (file:///..) as well as the traditional model of running from a webserver (http://...) Fetching this file from a webserver works exactly as expected using a RequestBuilder object. When running the app from the filesystem Firefox, Opera, Safari, and Chrome all behave as expected. When running the app from the filesystem using IE7 or IE8 the RequestBuilder.send() call fails, the information about the error suggests that there is a problem accessing the file due to violating the same origin policy. The app worked as expected in IE6 but not in IE7 or IE8. So I looked at the source code of RequestBuilder.java and saw that the actual request was being executed with an XMLHttpRequest GWT object. So I looked at the source code for XMLHttpRequest.java and found out some information. Here is the code (starts at line 83 in XMLHttpRequest.java) public static native XMLHttpRequest create() /*-{ if ($wnd.XMLHttpRequest) { return new XMLHttpRequest(); } else { try { return new ActiveXObject('MSXML2.XMLHTTP.3.0'); } catch (e) { return new ActiveXObject("Microsoft.XMLHTTP"); } } }-*/; So basically if an XMLHttpRequest cannot be created (like in IE6 because it is not available) an ActiveXObject is used instead. I read up a little bit more on the IE implementation of XMLHttpRequest, and it appears that it is only supported for interacting with files on a webserver. I found a setting in IE8 (Tools-Internet Options-Advanced-Security-Enable native XMLHTTP support), when I uncheck this box my app works. I assume this is because I am more of less telling IE to not use their implementation of XmlHttpRequest, so GWT just uses an ActiveXObject because it doesn't think the native XmlHttpRequest is available. This fixes the problem, but is hardly a long term solution. I can currently catch a failed send request and verify that it was trying to fetch the XML file from the filesystem using normal GWT. What I would like to do in this case is catch the IE7 and IE8 case and have them use a ActiveXObject instead of a native XmlHttpRequest object. There was a posting on the GWT google group that had a supposed solution for this problem (link). Looking at it I can tell that it was created for an older version of GWT. I am using the latest release and think that this is more or less what I would like to do (use GWT deferred binding to detect a specific browser type and run my own implementation of XMLHttpRequest.java in place of the built in GWT implementation). Here is the code that I am trying to use package com.mycompany.myapp.client; import com.google.gwt.xhr.client.XMLHttpRequest; public class XMLHttpRequestIE7or8 extends XMLHttpRequest { // commented out the "override" so that eclipse and the ant build script don't throw errors //@Override public static native XMLHttpRequest create() /*-{ try { return new ActiveXObject('MSXML2.XMLHTTP.3.0'); } catch (e) { return new ActiveXObject("Microsoft.XMLHTTP"); } }-*/; // have an empty protected constructor so the ant build script doesn't throw errors // the actual XMLHttpRequest constructor is empty as well so this shouldn't cause any problems protected XMLHttpRequestIE7or8() { } }; And here are the lines that I added to my module xml <replace-with class="com.mycompany.myapp.client.XMLHttpRequestIE7or8"> <when-type-is class="com.google.gwt.xhr.client.XMLHttpRequest"/> <any> <when-property-is name="user.agent" value="ie7" /> <when-property-is name="user.agent" value="ie8" /> </any> </replace-with> From what I can tell this should work, but my code never runs. Does anyone have any idea of what I am doing wrong? Should I not do this via deferred binding and just use native javascript when I catch the fail case instead? Is there a different way of approaching this problem that I have not mentioned? All replies are welcome.

    Read the article

  • jsp TextField binding

    - by user72185
    I have a panel in my Page1.jsp: <webuijsf:panelLayout binding="#{Page1.dynamicFieldsPanel}" id="dynamicFieldsPanel" -rave-layout: grid"/> Then I have this in Page1.java: private PanelLayout dynamicFieldsPanel = new PanelLayout(); public void setDynamicFieldsPanel(PanelLayout pl) { this.dynamicFieldsPanel = pl; } public PanelLayout getDynamicFieldsPanel() { TextField textField = new TextField(); this.dynamicFieldsPanel.getChildren().add(textField); return dynamicFieldsPanel; } How do I bind my dynamic TextField to something so I can retrieve the value entered by the user?

    Read the article

  • WPF: Binding items added to UserControl's exposed children

    - by Brian
    I have a user control that allows items to be added to it by exposing a Grid's Children property. Any control I add shows up fine but when I try to bind a property on the added item to a control in the main window nothing happens (example): <TextBox Name="txtTest" Text="Success!" /> <mycontrols:CustomUserControl.ExposedGridChildren> <TextBox Text="{Binding ElementName=txtTest, Path=Text, FallbackValue=fail}"/> </mycontrols:CustomUserControl.ExposedGridChildren> This example always results in the TextBox's text showing "fail". Here is how I'm exposing the children in the user control: public UIElementCollection ExposedGridChildren { get { return grdContainer.Children; } } Any thoughts? Is it a scope issue? I know I can't name the elements I add to the children because of scope errors. Thanks, Brian.

    Read the article

  • Puttting together binding navigators in a project

    - by vp789
    I am working on a group project in vb.net, in which all my team members are working on individual tables of a database. All of us are using binding navigator,where the GUI is created by drag and drop from the table. Is it possible to attach all these pieces together with imports or references? Will the changes made to the database while working on the program like table adapter can create problem? Do I need to make all those changes in database before importing ? Can you please give suggestions to put the project together.

    Read the article

  • Binding Navigation Property with Entity Framework

    - by JSmaga
    Hi, I have another question about binding using C# and the entity framework. Here, I'm looking to bind a navigation property to a listbox or a listview. I saw on different posts that if I update the collection using code behind the list would not be notified because the collection does not handle notification (it's always the same problem anyway). People suggested to use an ObservableCollection for example, but, and here is my question, this comes down to basically duplicate the collection and hence, if I modify it, I'd have to handle in code-behind the fact that the change has also to be applied to the "original" navigation property right? If that's the case, I was thinking: why not create a custom property called, say, MyObservableNavigationProperty in a partial class. I could then interact only with this collection, catch the event when the collection is changed and apply the change to the "original" collection. Is that a nice way to do the trick? or am I getting all confused here....

    Read the article

  • Binding Properties.Settings to Textbox fails

    - by user268098
    I would like to define a key & value in Settings.settings and bind the value by declaration in the XAML (not in the code behind by command). Here's what I've been trying in vain: Create a WPF project "Exp1" with Visual Studio Express 2010. Set one key named "TextFromSettings" to the value "Some Text from Setting". Add the attribute xmlns:p="clr-namespace:Exp1.Properties;assembly=Exp1" to the tag. Add Text="{Binding Path=TextFromSettings, Mode=TwoWay, Source={x:Static p:Settings.Default}}" to the tag Now, the preview window shows the text, however, the compiler fails: "Error 1 Cannot find the type 'Settings'. Note that type names are case sensitive." Where am I going wrong?

    Read the article

  • Dynamic binding in C++

    - by chmike
    I'm implementing a CORBA like server. Each class has remotely callable methods and a dispatch method with two possible input, a string identifying the method or an integer which would be the index of the method in a table. A mapping of the string to the corresponding integer would be implemented by a map. The caller would send the string on the first call and get back the integer with the response so that it simply has to send the integer on subsequent calls. It is just a small optimization. The integer may be assigned dynamically on demand by the server object. The server class may be derived from another class with overridden virtual methods. What could be a simple and general way to define the method binding and the dispatch method ?

    Read the article

  • Binding to object properties in C++

    - by Rich.Carpenter
    I've seen in WPF where you can bind control values to properties of other controls. How is that binding accomplished in C++? For example, if I have a class called Car and a guage control called RPM, how do I tie the value of RPM to the member variable Car.RPM, so that when Car.RPM changes, it is automatically (as in without a specific update call coded by me) reflected by the RPM control? General answers or directions to pertinent resources would be fine also, as I'm just beginning to dabble in C++ and haven't had much Google luck with this particular question.

    Read the article

  • Binding Data Template element to property on sub-class

    - by TerrorAustralis
    Hi guys, I have a class, for experiment sake call it foo() and another class, call it bar() I have a data template for class foo() defined in my xaml, but one of foo()'s properties is a bar() object such that foo() { Public string Name {get; set;} Public int ID {get; set;} Public bar barProp {get; set;} } and bar() { Public string Description{get; set;} } I want my data template of foo to display the Description property of bar. I have tried the simple <textblock Text="{Binding Path=barProp.Description}" /> and variants to no avail Seeking wisdom, DJ

    Read the article

  • XAML Binding to property

    - by imslavko
    I have check box in my XAML+C# Windows Store application. Also I have bool property: WindowsStoreTestApp.SessionData.RememberUser which is public and static. I want check box's property IsChecked to be consistent (or binded, or mapped) to this bool property. I tried this: XAML <CheckBox x:Name="chbRemember1" IsChecked="{Binding Mode=TwoWay}"/> C# chbRemember1.DataContext = SessionData.RememberUser; Code for property: namespace WindowsStoreTestApp { public class SessionData { public static bool RememberUser { get; set; } } } But it doesn't seem to work. Can you help me?

    Read the article

  • Flex Error: Repeater is not executing.

    - by creativepragmatic
    Hello Everyone, I have been trying to get a Repeater to work since yesterday. It works the first time it has been loaded with data but the second time, it is loaded, the following error results with the debugger higlighting a row with the statement isHandlingEvent = false; in the watcherFired method of the Binding class. This happens whether the Repeater is updated by setting its dataProvider or if a bound variable is changed. Thank you in advance for any help, Orville Error: Repeater is not executing. at mx.core::Repeater/get currentItem()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Repeater.as:305] at ()[F:\Projects\Flex\PrintPortal\src\ch\printportal\site\view\Shop.mxml:362] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.binding::Binding/wrapFunctionCall()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\Binding.as:287] at ()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\RepeatableBinding.as:139] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.binding::Binding/wrapFunctionCall()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\Binding.as:287] at mx.binding::RepeatableBinding/recursivelyProcessIDArray()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\RepeatableBinding.as:148] at mx.binding::RepeatableBinding/execute()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\RepeatableBinding.as:105] at mx.binding::BindingManager$/executeBindings()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\BindingManager.as:138] at mx.core::Container/executeBindings()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:3252] at mx.core::Container/createComponentFromDescriptor()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:3726] at mx.core::Container/createComponentsFromDescriptors()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:3536] at mx.core::Container/createChildren()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:2632] at mx.core::UIComponent/initialize()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:5370] at mx.core::Container/initialize()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:2569] at mx.core::UIComponent/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\UIComponent.as:5267] at mx.core::Container/http://www.adobe.com/2006/flex/mx/internal::childAdded()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:3348] at mx.core::Container/addChildAt()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:2260] at mx.core::Container/addChild()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:2183] at mx.core::Container/createComponentFromDescriptor()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Container.as:3724] at mx.core::Repeater/createComponentFromDescriptor()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Repeater.as:734] at mx.core::Repeater/createComponentsFromDescriptors()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Repeater.as:786] at mx.core::Repeater/recreate()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Repeater.as:1075] at mx.core::Repeater/execute()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Repeater.as:1095] at mx.core::Repeater/set dataProvider()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\core\Repeater.as:402] at ()[F:\Projects\Flex\PrintPortal\src\ch\printportal\site\view\Shop.mxml:358] at Function/http://adobe.com/AS3/2006/builtin::call() at mx.binding::Binding/innerExecute()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\Binding.as:375] at Function/http://adobe.com/AS3/2006/builtin::apply() at mx.binding::Binding/wrapFunctionCall()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\Binding.as:287] at mx.binding::Binding/execute()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\Binding.as:230] at mx.binding::Binding/watcherFired()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\Binding.as:396] at mx.binding::Watcher/notifyListeners()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\Watcher.as:299] at mx.binding::PropertyWatcher/eventHandler()[C:\autobuild\galaga\frameworks\projects\framework\src\mx\binding\PropertyWatcher.as:327] at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at ch.printportal.site.model::ModelLocator/dispatchEvent()[F:\Projects\Flex\PrintPortal\src\ch\printportal\site\model\ModelLocator.as:73] at ch.printportal.site.model::ModelLocator/set arrCategoryView2Products()[F:\Projects\Flex\PrintPortal\src\ch\printportal\site\model\ModelLocator.as:71] at ch.printportal.site.command::GetProductsCommand/result()[F:\Projects\Flex\PrintPortal\src\ch\printportal\site\command\GetProductsCommand.as:47] at mx.rpc::AsyncToken/http://www.adobe.com/2006/flex/mx/internal::applyResult()[C:\autobuild\galaga\frameworks\projects\rpc\src\mx\rpc\AsyncToken.as:199] at mx.rpc.events::ResultEvent/http://www.adobe.com/2006/flex/mx/internal::callTokenResponders()[C:\autobuild\galaga\frameworks\projects\rpc\src\mx\rpc\events\ResultEvent.as:172] at mx.rpc::AbstractOperation/http://www.adobe.com/2006/flex/mx/internal::dispatchRpcEvent()[C:\autobuild\galaga\frameworks\projects\rpc\src\mx\rpc\AbstractOperation.as:199] at mx.rpc::AbstractInvoker/http://www.adobe.com/2006/flex/mx/internal::resultHandler()[C:\autobuild\galaga\frameworks\projects\rpc\src\mx\rpc\AbstractInvoker.as:263] at mx.rpc::Responder/result()[C:\autobuild\galaga\frameworks\projects\rpc\src\mx\rpc\Responder.as:46] at mx.rpc::AsyncRequest/acknowledge()[C:\autobuild\galaga\frameworks\projects\rpc\src\mx\rpc\AsyncRequest.as:74] at NetConnectionMessageResponder/resultHandler()[C:\autobuild\galaga\frameworks\projects\rpc\src\mx\messaging\channels\NetConnectionChannel.as:514] at mx.messaging::MessageResponder/result()[C:\autobuild\galaga\frameworks\projects\rpc\src\mx\messaging\MessageResponder.as:199]

    Read the article

  • Binding In Binding with Templates(WPF)

    - by AKRamkumar
    I have a WPF UI Bound to a collection of AwesomeClass Now, AwesomeClass has a collection of AwesomeParts objects. How can I make my UI In such a way that (as an example) for each AwesomeClass instance, there is a Tab on a tab panel and then for each awesome part in that, there is an object on a listbox, on that tab. Basically: Awesomes-Tabs And Then : Awesome.Awesomeparts-Tabs.Listbox

    Read the article

  • WCF: Manually configuring Binding and Endpoint causes SerciveChannel Faulted State

    - by Matthias
    Hi there, I've created a ComVisible assembly to be used in a classic-asp application. The assembly should act as a wcf client and connect to a wcf service host (inside a windows service) on the same machine using named pipes. The wcf service host works fine with other clients, so the problem must be within this assembly. In order to get things work I added a service reference to the ComVisible assembly and proxy classes and the corresponding app.config settings were generated for me. Everything fine so far except that the app config would not be recognized when doing an CreateObject with my assembly in the asp code. I went and tried to hardcode (just for testing) the Binding and Endpoint and pass those two to the constructor of my ClientBase derived proxy using this code: private NetNamedPipeBinding clientBinding = null; private EndpointAddress clientAddress = null; clientBinding = new NetNamedPipeBinding(); clientBinding.OpenTimeout = new TimeSpan(0, 1, 0); clientBinding.CloseTimeout = new TimeSpan(0, 0, 10); clientBinding.ReceiveTimeout = new TimeSpan(0, 2, 0); clientBinding.SendTimeout = new TimeSpan(0, 1, 0); clientBinding.TransactionFlow = false; clientBinding.TransferMode = TransferMode.Buffered; clientBinding.TransactionProtocol = TransactionProtocol.OleTransactions; clientBinding.HostNameComparisonMode = HostNameComparisonMode.StrongWildcard; clientBinding.MaxBufferPoolSize = 524288; clientBinding.MaxBufferSize = 65536; clientBinding.MaxConnections = 10; clientBinding.MaxReceivedMessageSize = 65536; clientAddress = new EndpointAddress("net.pipe://MyService/"); MyServiceClient client = new MyServiceClient(clientBinding, clientAddress); client.Open(); // do something with the client client.Close(); But this causes the following error: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the faulted state. The environment is .Net Framework 3.5 / C#. What am I missing here?

    Read the article

  • WCF Double Hop questions about Security and Binding.

    - by Ken Maglio
    Background information: .Net Website which calls a service (aka external service) facade on an app server in the DMZ. This external service then calls the internal service which is on our internal app server. From there that internal service calls a stored procedure (Linq to SQL Classes), and passes the serialized data back though to the external service, and from there back to the website. We've done this so any communication goes through an external layer (our external app server) and allows interoperability; we access our data just like our clients consuming our services. We've gotten to the point in our development where we have completed the system and it all works, the double hop acts as it should. However now we are working on securing the entire process. We are looking at using TransportWithMessageCredentials. We want to have WS2007HttpBinding for the external for interoperability, but then netTCPBinding for the bridge through the firewall for security and speed. Questions: If we choose WS2007HttpBinding as the external services binding, and netTCPBinding for the internal service is this possible? I know WS-* supports this as does netTCP, however do they play nice when passing credential information like user/pass? If we go to Kerberos, will this impact anything? We may want to do impersonation in the future. If you can when you answer post any reference links about why you're answering the way you are, that would be very helpful to us. Thanks!

    Read the article

  • Binding ListBox to List (Collection) in XAML

    - by david2tm
    Hello, I'm learning WPF, so I'm kind of n00b in this. I saw some examples about how to do what I want to do, but nothing exactly... The question: I want to bind List to ListBox. I want to do it in XAML, w/o coding in code behind. How can I achieve that? Right now I do it that way: <!-- XAML --> <ListBox x:Name="FileList"> <ListBox.ItemTemplate> <DataTemplate> <Label Content="{Binding Path=.}"/> </DataTemplate> </ListBox.ItemTemplate> </ListBox> // Code behind public MainWindow() { // ... files = new List<string>(); FileList.ItemsSource = files; } private void FolderBrowser_TextChanged(object sender, RoutedEventArgs e) { string folder = FolderBrowser.Text; files.Clear(); files.AddRange(Directory.GetFiles(folder, "*.txt", SearchOption.AllDirectories)); FileList.Items.Refresh(); } But I want to get rid of FileList.ItemsSource = files; and FileList.Items.Refresh(); in C# code. Thanks

    Read the article

  • WPF DataGrid binding difficulties

    - by Jasmin Pvvlovic
    This is the class: public class TrainingData { public string Training { get; set; } } And this is the rest of the code in MainWindow: Excel.Workbook xlWorkbook = xlApp.Workbooks.Open("D:/excel.xlsx"); Excel._Worksheet xlWorksheet = xlWorkbook.Sheets[1]; Excel.Range xlRange = xlWorksheet.UsedRange; List <TrainingData> tData= new List <TrainingData>(); int rowCount = xlRange.Rows.Count; int colCount = xlRange.Columns.Count; //int k = 0; for (int i = 1; i <= rowCount; i++) { tData.Add(new TrainingData() { Training = xlRange.Cells[i, 1].Value2.ToString() }); //MessageBox.Show(tData[k].Training); //k++; } Prikaz.ItemsSource = tData; DataGrid: <DataGrid AutoGenerateColumns="False" Height="120" HorizontalAlignment="Left" Margin="12,12,0,0" Name="Prikaz" VerticalAlignment="Top" Width="105" ItemsSource="{Binding}"> <DataGrid.Columns> <DataGridTextColumn Header="Header" /> </DataGrid.Columns> </DataGrid>` So, Prikaz is my DataGrid. tData is List of TrainingData objects. If I uncomment these three lines I can test if I have imported information from excel file correctly, and yes, that works just fine. So why am I getting empty DataGrid? It has right number of rows and only one column, that's ok, but there are no data in it. I used this line: Prikaz.ItemsSource = tData; to bind my objects list and DataGrid. Training is declared public so it should be present in DataGrid. What could be causing the problem?

    Read the article

  • Data Binding to an object in C#

    - by Allen
    Objective-c/cocoa offers a form of binding where a control's properties (ie text in a textbox) can be bound to the property of an object. I am trying to duplicate this functionality in C# w/ .Net 3.5. I have created the following very simple class in the file MyClass.cs: class MyClass { private string myName; public string MyName { get { return myName; } set { myName = value; } } public MyClass() { myName = "Allen"; } } I also created a simple form with 1 textbox and 1 button. I init'd one instance of Myclass inside the form code and built the project. Using the DataSource Wizard in Vs2008, i selected to create a data source based on object, and selected the MyClass assembly. This created a datasource entity. I changed the databinding of the textbox to this datasource; however, the expected result (that the textbox's contents would be "allen") was not achieved. Further, putting text into the textbox is not updating the name property of the object. I know i'm missing something fundamental here. At some point i should have to tie my instance of the MyClass class that i initialized inside the form code to the textbox, but that hasn't occurred. Everything i've looked at online seems to gloss over using DataBinding with an object (or i'm missing the mark entirely), so any help is great appreciated. ----Edit--- Utilizing what i learned by the answers, i looked at the code generated by Visual Studio, it had the following: this.myClassBindingSource.DataSource = typeof(BindingTest.MyClass); if i comment that out and substitute : this.myClassBindingSource.DataSource = new MyClass(); i get the expected behavior. Why is the default code generated by VS like it is? Assuming this is more correct than the method that works, how should i modify my code to work within the bounds of what VS generated?

    Read the article

  • ASP.NET MVC - Binding a Child Entity to the Model

    - by Nathan Taylor
    This one seems painfully obvious to me, but for some reason I can't get it working the way I want it to. Perhaps it isn't possible the way I am doing it, but that seems unlikely. This question may be somewhat related: http://stackoverflow.com/questions/1274855/asp-net-mvc-model-binding-related-entities-on-same-page. I have an EditorTemplate to edit an entity with multiple related entity references. When the editor is rendered the user is given a drop down list to select related entities from, with the drop down list returning an ID as its value. <%=Html.DropDownListFor(m => m.Entity.ID)%> When the request is sent the form value is named as expected: "Entity.ID", however my strongly typed Model defined as an action parameter doesn't have Entity.ID populated with the value passed in the request. public ActionResult AddEntity(EntityWithChildEntities entityWithChildEntities) { } I tried fiddling around with the Bind() attribute and specified Bind(Include = "Entity.ID") on the entityWithChildEntities, but that doesn't seem to work. I also tried Bind(Include = "Entity"), but that resulted in the ModelBinder attempting to bind a full "Entity" definition (not surprisingly). Is there any way to get the default model binder to fill the child entity ID or will I need to add action parameters for each child entity's ID and then manually copy the values into the model definition?

    Read the article

  • Model binding & derived model classes

    - by Richard Ev
    Does ASP.NET MVC offer any simple way to get model binding to work when you have model classes that inherit from others? In my scenario I have a View that is strongly typed to List<Person>. I have a couple of classes that inherit from Person, namely PersonTypeOne and PersonTypeTwo. I have three strongly typed partial views with names that match these class names (and render form elements for the properties of their respective models). This means that in my main View I can have the following code: <% for(int i = 0; i < Model.Count; i++) { Html.RenderPartial(Model[i].GetType().Name, Model[i]); } %> This works well, apart from when the user submits the form the relevant controller action method just gets a List<Person>, rather than a list of Person, PersonTypeOne and PersonTypeTwo. This is pretty much as expected as the form submission doesn't contain enough information to tell the default model binder to create any instances of PersonTypeOne and PersonTypeTwo classes. So, is there any way to get such functionality from the default model binder?

    Read the article

  • C# - Naming a value combined "getter/setter" method (WebForms & Binding)

    - by tyndall
    Looking for some help on some names for a project I'm currently working on. I don't have a compsci degree so I don't know what to call this. I have a method called TryToGetSetValue(Direction direction, object value, object valueOnFail) Then there would be a Direction enum public enum Direction { ModelToForm, FormToModel } Background This is a legacy ASP.NET application. The models, database, and mainframe are designed poorly. I can't put in MVP or MVC patterns yet (too much work). ASP.NET code is a ridiculous mess (partial pages, single-page design, 5x the normal amount of jQuery, everything is a jQuery UI dialog). I'm just trying to put in a bridge so then I can do more refactoring over the next year. I have ~200 fields that need to be set on a GET and written back on a POST. I trying not to x2 these 200 fields and have 400 lines of code to support. What would you call my method? enum? Is there so other form of binding that would be easy to use instead? I'm not a fan of the DetailsView or FormView built-ins of ASP.NET WebForms.

    Read the article

  • Issue binding Image Source dependency property

    - by Archana R
    Hello, I have created a custom control for ImageButton as <Style TargetType="{x:Type Button}"> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Local:ImageButton}"> <StackPanel Height="Auto" Orientation="Horizontal"> <Image Margin="0,0,3,0" Source="{Binding ImageSource}" /> <TextBlock Text="{TemplateBinding Content}" /> </StackPanel> </ControlTemplate> </Setter.Value> </Setter> </Style> ImageButton class looks like public class ImageButton : Button { public ImageButton() : base() { } public ImageSource ImageSource { get { return base.GetValue(ImageSourceProperty) as ImageSource; } set { base.SetValue(ImageSourceProperty, value); } } public static readonly DependencyProperty ImageSourceProperty = DependencyProperty.Register("Source", typeof(ImageSource), typeof(ImageButton)); } However I'm not able to bind the ImageSource to the image as: (This code is in UI Folder and image is in Resource folder) <Local:ImageButton x:Name="buttonBrowse1" Width="100" Margin="10,0,10,0" Content="Browse ..." ImageSource="../Resources/BrowseFolder.bmp"/> But if i take a simple image it gets displayed if same source is specified. Can anyone tell me what shall be done?

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >