Search Results

Search found 3307 results on 133 pages for 'distributed datasource'.

Page 46/133 | < Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >

  • How to assign class property as display data memeber in datagridview

    - by KoolKabin
    hi guys, I am trying to display my data in datagridview. I created a class with different property and used its list as the datasource. it worked fine. but i got confused how to do that in case we have nested class. My Classes are as follows: class Category property UIN as integer property Name as string end class class item property uin as integer property name as string property mycategory as category end class my data list as follows: dim myDataList as list(of Item) = new List(of Item) myDataList.Add(new Item(1,"item1",new category(1,"cat1"))) myDataList.Add(new Item(2,"item2",new category(1,"cat1"))) myDataList.Add(new Item(3,"item3",new category(1,"cat1"))) myDataList.Add(new Item(4,"item4",new category(2,"cat2"))) myDataList.Add(new Item(5,"item5",new category(2,"cat2"))) myDataList.Add(new Item(6,"item6",new category(2,"cat2"))) Now I binded the datagridview control like: DGVMain.AutoGenerateColumns = False DGVMain.ColumnCount = 3 DGVMain.Columns(0).DataPropertyName = "UIN" DGVMain.Columns(0).HeaderText = "ID" DGVMain.Columns(1).DataPropertyName = "Name" DGVMain.Columns(1).HeaderText = "Name" DGVMain.Columns(2).DataPropertyName = "" **'here i want my category name** DGVMain.Columns(2).HeaderText = "category" DGVMain.datasource = myDataList DGVMain.refresh() I have tried using mycategory.name but it didn't worked. What can be done to get expected result? Is there any better idea other than this to accomplish the same task?

    Read the article

  • How to fix IllegalStateException error when trying to update a listview?

    - by Michael Vetrano
    Hi guys, I am trying to get this code to run, but I get an IllegalStateException when I run this code saying that the content of the listview wasn't notified, yet I have a notification upon updating the data. This is a custom listview adapter. Here is the relevant part of my code: class LoadingThread extends Thread { public void run() { int itemsOriginallyLoaded = 0; synchronized( items ) { itemsOriginallyLoaded = items.size(); } for( int i = itemsOriginallyLoaded ; i < itemsToLoad ; ++i ) { Log.d( LOG_TAG, "Loading item #"+i ); //String item = "FAIL"; //try { String item = "FAIL"; try { item = stockGrabber.getStockString(dataSource.get(i)); } catch (ApiException e) { Log.e(LOG_TAG, "Problem making API request", e); } catch (ParseException e) { Log.e(LOG_TAG, "Problem parsing API request", e); } //} catch (ApiException e) { // Log.e(TAG, "Problem making API request", e); //} catch (ParseException e) { // Log.e(TAG, "Problem parsing API request", e); //} synchronized( items ) { items.add( item ); } itemsLoaded = i+1; uiHandler.post( updateTask ); Log.d( LOG_TAG, "Published item #"+i ); } if( itemsLoaded >= ( dataSource.size() - 1 ) ) allItemsLoaded = true; synchronized( loading ) { loading = Boolean.FALSE; } } } class UIUpdateTask implements Runnable { public void run() { Log.d( LOG_TAG, "Publishing progress" ); notifyDataSetChanged(); } }

    Read the article

  • Java Mvc And Hibernate

    - by GigaPr
    Hi i am trying to learn Java, Hibernate and the MVC pattern. Following various tutorial online i managed to map my database, i have created few Main methods to test it and it works. Furthermore i have created few pages using the MVC patter and i am able to display some mock data as well in a view. the problem is i can not connect the two. this is what i have My view Looks like this <%@ include file="/WEB-INF/jsp/include.jsp" %> <html> <head> <title>Users</title> <%@ include file="/WEB-INF/jsp/head.jsp" %> </head> <body> <%@ include file="/WEB-INF/jsp/header.jsp" %> <img src="images/rss.png" alt="Rss Feed"/> <%@ include file="/WEB-INF/jsp/menu.jsp" %> <div class="ContainerIntroText"> <img src="images/usersList.png" class="marginL150px" alt="Add New User"/> <br/> <br/> <div class="usersList"> <div class="listHeaders"> <div class="headerBox"> <strong>FirstName</strong> </div> <div class="headerBox"> <strong>LastName</strong> </div> <div class="headerBox"> <strong>Username</strong> </div> <div class="headerAction"> <strong>Edit</strong> </div> <div class="headerAction"> <strong>Delete</strong> </div> </div> <br><br> <c:forEach items="${users}" var="user"> <div class="listElement"> <c:out value="${user.firstName}"/> </div> <div class="listElement"> <c:out value="${user.lastName}"/> </div> <div class="listElement"> <c:out value="${user.username}"/> </div> <div class="listElementAction"> <input type="button" name="Edit" title="Edit" value="Edit"/> </div> <div class="listElementAction"> <input type="image" src="images/delete.png" name="image" alt="Delete" > </div> <br /> </c:forEach> </div> </div> <a id="addUser" href="addUser.htm" title="Click to add a new user">&nbsp;</a> </body> </html> My controller public class UsersController implements Controller { private UserServiceImplementation userServiceImplementation; public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { ModelAndView modelAndView = new ModelAndView("users"); List<User> users = this.userServiceImplementation.get(); modelAndView.addObject("users", users); return modelAndView; } public UserServiceImplementation getUserServiceImplementation() { return userServiceImplementation; } public void setUserServiceImplementation(UserServiceImplementation userServiceImplementation) { this.userServiceImplementation = userServiceImplementation; } } My servelet definitions <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <!-- the application context definition for the springapp DispatcherServlet --> <bean name="/home.htm" class="com.rssFeed.mvc.HomeController"/> <bean name="/rssFeeds.htm" class="com.rssFeed.mvc.RssFeedsController"/> <bean name="/addUser.htm" class="com.rssFeed.mvc.AddUserController"/> <bean name="/users.htm" class="com.rssFeed.mvc.UsersController"> <property name="userServiceImplementation" ref="userServiceImplementation"/> </bean> <bean id="userServiceImplementation" class="com.rssFeed.ServiceImplementation.UserServiceImplementation"> <property name="users"> <list> <ref bean="user1"/> <ref bean="user2"/> </list> </property> </bean> <bean id="user1" class="com.rssFeed.domain.User"> <property name="firstName" value="firstName1"/> <property name="lastName" value="lastName1"/> <property name="username" value="username1"/> <property name="password" value="password1"/> </bean> <bean id="user2" class="com.rssFeed.domain.User"> <property name="firstName" value="firstName2"/> <property name="lastName" value="lastName2"/> <property name="username" value="username2"/> <property name="password" value="password2"/> </bean> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"></property> <property name="prefix" value="/WEB-INF/jsp/"></property> <property name="suffix" value=".jsp"></property> </bean> </beans> and finally this class to access the database public class HibernateUserDao extends HibernateDaoSupport implements UserDao { public void addUser(User user) { getHibernateTemplate().saveOrUpdate(user); } public List<User> get() { User user1 = new User(); user1.setFirstName("FirstName"); user1.setLastName("LastName"); user1.setUsername("Username"); user1.setPassword("Password"); List<User> users = new LinkedList<User>(); users.add(user1); return users; } public User get(int id) { throw new UnsupportedOperationException("Not supported yet."); } public User get(String username) { return null; } } the database connection occurs in this file <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd"> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="org.hsqldb.jdbcDriver"/> <property name="url" value="jdbc:hsqldb:hsql://localhost/rss"/> <property name="username" value="sa"/> <property name="password" value=""/> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean" > <property name="dataSource" ref="dataSource" /> <property name="mappingResources"> <list> <value>com/rssFeed/domain/User.hbm.xml</value> </list> </property> <property name="hibernateProperties" > <props> <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop> </props> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager"> <property name="sessionFactory" ref="sessionFactory"/> </bean> <bean id="userDao" class="com.rssFeed.dao.hibernate.HibernateUserDao"> <property name="sessionFactory" ref="sessionFactory"/> </bean> </beans> Could you help me to solve this problem i spent the last 4 days and nights on this issue without any success Thanks

    Read the article

  • jboss cache as hibernate 2nd level - cluster node doesn't persist replicated data

    - by Sergey Grashchenko
    I'm trying to build an architecture basically described in user guide http://www.jboss.org/file-access/default/members/jbosscache/freezone/docs/3.2.1.GA/userguide_en/html/cache_loaders.html#d0e3090 (Replicated caches with each cache having its own store.) but having jboss cache configured as hibernate second level cache. I've read manual for several days and played with the settings but could not achieve the result - the data in memory (jboss cache) gets replicated across the hosts, but it's not persisted in the datasource/database of the target (not original) cluster host. I had a hope that a node might become persistent at eviction, so I've got a cache listener and attached it to @NoveEvicted event. I found that though I could adjust eviction policy to fully control it, no any persistence takes place. Then I had a though that I could try to modify CacheLoader to set "passivate" to true, but I found that in my case (hibernate 2nd level cache) I don't have a way to access a loader. I wonder if replicated data persistence is possible at all by configuration tuning ? If not, will it work for me to create some manual peristence in CacheListener (I could check whether the eviction event is local, and if not - persist it to hibernate datasource somehow) ? I've used mvcc-entity configuration with the modification of cacheMode - set to REPL_ASYNC. I've also played with the eviction policy configuration. Last thing to mention is that I've tested entty persistence and replication in project that has been generated with Seam. I guess it's not important though.

    Read the article

  • [C#]Update Datatable and DatagridView with database Changes by Timer

    - by aleroot
    Scenario : i have a database table that is being apdated frequently bey some services. I have a c# Winform Application that load this table in a datagridview by binding a datatable as Datasource, then i whant to add a Timer that every 10 seconds update a the content of a datatable with the last changes in the database table ... I don't need to update a database with the datatable changes, but i need to update datatable with the last changes in the database table, that is the inverse of the usually.... Is there a way to do that ? What is the best way ? i've tried with this code : private void ServiceTimer_Tick(object state) { OdbcConnection oCon = new OdbcConnection(); oCon.ConnectionString = ConnectionStrings; OdbcDataAdapter dp = new OdbcDataAdapter("SELECT * FROM table", oCon); dsProva.Tables.Clear(); dp.Fill(dsProva,"table"); dataGridViewMessaggi.DataSource = dsProva.Tables["table"]; dataGridViewMessaggi.Refresh(); } But every Timer Tick i lost the selection in DatagridView and Current Row .... Is There a better solution ?

    Read the article

  • Problems migrating databinding in VB.NET from Winforms to ASP.NET 2.0

    - by David
    And this was supposed to be so easy... I have existing business and data access layers that handle the retrieval and update of the data in question. These work great with the existing Winforms application (.Net V2.0) Now, in trying to write a new web-based UI, I'm running into all sorts of problems (last time I wrote asp.net code was in 1.1). Specifically, I can't data bind a text box to a business object. Oh, sure there's the ObjectDataSource but that wants to know how to do CRUD operations on the data. What I'm looking for is something that acts like the 'classic' binding objects so that, in my code, it's as simple as retrieving the object and doing a a refresh. The data component like FormView and DetailsView are so generic-looking that it's ridiculous. The existing application would have tabbed dialogs, text boxes grouped by panels, etc. On top of that, I have a directive to use master pages and unless one control causes it, I can't seem to get the content section to expand. I can't just put a text box 'below' the bottom of "Content1" and have it resize the content section - which gives me the same results as an earlier question I posted when the footer wasn't being 'pushed down' - relative position solved that but doesn't seem to solve it with placing small text boxes in the area. What I want is fairly simple. Something like: bindingobject.datasource = businessdataobject bindingobject.refresh ...and have the text boxes refresh with the new values. Likewise to have 'businessdataobject' properties updated as the user enters new data. I was able to do this with the GridView (grdRequests.DataSource = lstRequests) by making a list of asp:BoundField tags inside the collection of the GridView. Am I tilting at windmills here?

    Read the article

  • Dynamically Run IQueryable Method

    - by Micah
    Hi! I'm trying to run the Count() function of a Linq statement in an overriden Gridview function. Basically, I want to be able to assign a linq query to a gridview, and on the OnDataBound(e) event in my new extended gridview have it retrieve the count, using the IQueryable. This is where I'm at so far: protected override void OnDataBound(EventArgs e) { IEnumerable _data = null; if (this.DataSource is IQueryable) { _data = (IQueryable)this.DataSource; } System.Type dataSourceType = _data.GetType(); System.Type dataItemType = typeof(object); if (dataSourceType.HasElementType) { dataItemType = dataSourceType.GetElementType(); } else if (dataSourceType.IsGenericType) { dataItemType = dataSourceType.GetGenericArguments()[0]; } else if (_data is IEnumerable) { IEnumerator dataEnumerator = _data.GetEnumerator(); if (dataEnumerator.MoveNext() && dataEnumerator.Current != null) { dataItemType = dataEnumerator.Current.GetType(); } } Object o = Activator.CreateInstance(dataItemType); object[] objArray = new object[] { o }; RowCount = (int)dataSourceType.GetMethod("Count").Invoke(_data, objArray); Any ideas? I'm really new with working with IQueryables and Linq so I may be way off. How can I get my _data to allow me to run the Count function?

    Read the article

  • Update Datatable and DatagridView with database Changes by Timer

    - by aleroot
    Scenario : i have a database table that is being updated frequently by some services. I have a c# Winforms Application that load this table in a datagridview by binding a datatable as Datasource, then i whant to add a Timer that every 10 seconds update a the content of a datatable with the last changes in the database table ... I don't need to update a database with the datatable changes, but i need to update datatable with the last changes in the database table, that is the inverse of the usually.... Is there a way to do that ? What is the best way ? i've tried with this code : private void ServiceTimer_Tick(object state) { OdbcConnection oCon = new OdbcConnection(); oCon.ConnectionString = ConnectionStrings; OdbcDataAdapter dp = new OdbcDataAdapter("SELECT * FROM table", oCon); dsProva.Tables.Clear(); dp.Fill(dsProva,"table"); dataGridViewMessaggi.DataSource = dsProva.Tables["table"]; dataGridViewMessaggi.Refresh(); } But every Timer Tick i lost the selection in DatagridView and Current Row .... Is There a better solution ?

    Read the article

  • UITableView superClass for delegate?

    - by fuzzygoat
    A quick question, I am setting a delegate for UITableView and I have a question regarding setting the delegate and dataSource properties. I have noticed that the properties for delegate and dataSource are not available, I was thinking that adopting the protocols would make them available. But I am now thinking that I maybe have the superclass for my delegate class wrong. Currently I have: -(void)viewDidLoad { TestDelegate *tempDelegate = [[TestDelegate alloc] init]; [self setMyDelegate:tempDelegate]; // setDelegate // setDataSource [tempDelegate release]; [super viewDidLoad]; } My interface for TestDelegate looks like: @interface TestDelegate : NSObject <UITableViewDelegate, UITableViewDataSource> { NSArray *listData; int myCounter; } Can I ask if the above should be: @interface TestDelegate : UITableView <UITableViewDelegate, UITableViewDataSource> { NSArray *listData; int myCounter; } gary EDIT: I think it might be right as NSObject, I have a viewtableView in IB, thats what I will need to connect my delegate class to. I added to tableView in IB so maybe I just need to make it available in Xcode.

    Read the article

  • MySQL query puzzle - finding what WOULD have been the most recent date

    - by Hank
    I've looked all over and haven't yet found an intelligent way to handle this, though I feel sure one is possible: One table of historical data has quarterly information: CREATE TABLE Quarterly ( unique_ID INT UNSIGNED NOT NULL, date_posted DATE NOT NULL, datasource TINYINT UNSIGNED NOT NULL, data FLOAT NOT NULL, PRIMARY KEY (unique_ID)); Another table of historical data (which is very large) contains daily information: CREATE TABLE Daily ( unique_ID INT UNSIGNED NOT NULL, date_posted DATE NOT NULL, datasource TINYINT UNSIGNED NOT NULL, data FLOAT NOT NULL, qtr_ID INT UNSIGNED, PRIMARY KEY (unique_ID)); The qtr_ID field is not part of the feed of daily data that populated the database - instead, I need to retroactively populate the qtr_ID field in the Daily table with the Quarterly.unique_ID row ID, using what would have been the most recent quarterly data on that Daily.date_posted for that data source. For example, if the quarterly data is 101 2009-03-31 1 4.5 102 2009-06-30 1 4.4 103 2009-03-31 2 7.6 104 2009-06-30 2 7.7 105 2009-09-30 1 4.7 and the daily data is 1001 2009-07-14 1 3.5 ?? 1002 2009-07-15 1 3.4 && 1003 2009-07-14 2 2.3 ^^ then we would want the ?? qtr_ID field to be assigned '102' as the most recent quarter for that data source on that date, and && would also be '102', and ^^ would be '104'. The challenges include that both tables (particularly the daily table) are actually very large, they can't be normalized to get rid of the repetitive dates or otherwise optimized, and for certain daily entries there is no preceding quarterly entry. I have tried a variety of joins, using datediff (where the challenge is finding the minimum value of datediff greater than zero), and other attempts but nothing is working for me - usually my syntax is breaking somewhere. Any ideas welcome - I'll execute any basic ideas or concepts and report back.

    Read the article

  • Can I get the item type from a BindingSource?

    - by Preston
    I would like to get the Type of item that a BindingSource is hooked up to or configured for. The BindingSource.DataSource property can be set to an object, list, or type. If it is a Type, it obviously does not have an bound item yet, but I would still like to get the Type. For a List, I need the item Type, not the list type. There is a method BindingSource.GetItemProperties, that accomplishes most of what I need. It gets the PropertyDescriptors for the Type, list item, or object specified by the DataSource and DataMember. The reason I ask, is that I have some components that I would like to re-use, but they are currently setup to work off of an item Type. The Type is mainly used to get PropertyInfos and then build a UI, but PropertyInfo and PropertyDescriptor is not exactly the same, so it is not immediately apparent that they can be reworked to use a PropertyDescriptor collection instead. Then there is cascading refactoring of everything already using these components and that adds up to a lot of work that I would rather not do. I've looked through the API docs for for a good way to do this, but so far I have not had any luck. Am I missing something or is this just something I can not or should not be doing?

    Read the article

  • ios UITableView reloadData don't increase content height

    - by Zoltan Varadi
    I'm facing a strange error in my iOS app and haven't been able to figure out the reason why. In my UITableView i can add new cells, so i refresh the array that is the datasource and call reloadData. Everything works without error. The numberOfRowsInSection is called again, and it's value is one more than it's previous value was. The new cell even gets inserted at the bottom of the tableview, but i cant scroll down to it. I only know that it's there because the tableview bounces and i can see it. I'm guessing the tableview's content height is not getting increased for some reason, but i have no idea why. I'm using iOS 6 btw. Any help is very much appreciated! Thanks, Zoli EDIT, answers for Srikanth's questions: How is data getting added. There's an NSArray containing objects of a specific type. The array.count is the number of the number of cells. This NSArray gets its values from a database query. When you say, you are refreshing the array, what do you mean. By refreshing the array i mean i execute a new query in the database and put the results of this query into an NSArray. this will be the tableview's datasource array. Like this: dataSourceArray = [dbManager executeQuery]; [tableView reloadData]; Are you adding the data within the same view controller Yes. Can you show some code as to what you are doing See above. Is the table view at the root of the view controllers view or is it within another view The tableview is the main view's first child. Can you try adding data to the array at the beginning, so that you can view the cell being added at the top. I don't understand what you mean.

    Read the article

  • dropdownlist binding from function in code behind aspx vb

    - by Dr.H
    so I have this working in C# , why it is not working in VB public string[] CustomizedRoles() { int length = Roles.GetAllRoles().Length; string[] arrRoles=Roles.GetAllRoles(); string[] customizedRoles= new string[length+1]; customizedRoles[0] = ""; for (int i = 1; i < length+1; i++) { customizedRoles[i] = arrRoles[i-1]; } return customizedRoles; } asp:GridView.... asp:DropDownList ID="ddlOwnerRolesUpdate" runat="server" DataSource="<%# CustomizedRoles() %" Height="25px" Width="177px" SelectedValue='<%# Bind("Owner") %' where is "Owner" is a data value come from a datasource for the grid it is working fine in C# . in Vb with the same aspx and this code behind it is not working. Public Function CustomizedRoles() As String() Dim length As Integer = Roles.GetAllRoles().Length Dim arrRoles As String() = Roles.GetAllRoles() Dim _customizedRoles As String() = New String(length + 1) {} _customizedRoles(0) = " " For index As Integer = 1 To length _customizedRoles(index) = arrRoles(index - 1) Next Return _customizedRoles End Function can anyone show me how to bind array of string to a dropdownlist from aspx to code behind in VB

    Read the article

  • Java and Jasper

    - by bhargava
    Hey Guys, I have integrated Jasper Reports on my netbeans platform and i am able to generate reports using the following code. Map<String, Object> params = new HashMap<String, Object>(); Connection conn = DriverManager.getConnection("databaseUrl", "userid","password"); JasperReport jasperReport = JasperCompileManager.compileReport(reportSource); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, conn); JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDest); JasperViewer.viewReport(jasperPrint); This stuff works perfect. But not i am trying to integrate Jasper with GWT.I have my server as glass fish server. I am getting the Connection object using the followind code. public static Connection getConnection() { try { String JNDI = "JNDI name"; InitialContext initCtx = new InitialContext(); javax.sql.DataSource ds = (javax.sql.DataSource) initCtx.lookup(JNDI); Connection conn = (Connection) ds.getConnection(); return conn; } catch (Exception ex) { ex.printStackTrace(); } return null; } and then Map params = new HashMap(); JasperReport jasperReport = JasperCompileManager.compileReport(reportSource); JasperPrint jasperPrint = JasperFillManager.fillReport(jasperReport, params, getConnection()); JasperExportManager.exportReportToHtmlFile(jasperPrint, reportDest); JasperViewer.viewReport(jasperPrint); but i always get Error.I am implementing this on Server.I am having RPC calls to get this method to work when a button is clicked. Can you please help me how to work on this.(That is to integrate Jasper reports with GWT). I would highly appreciate any explanation with some code as i am just a beginner. Thanks

    Read the article

  • C#: Using one Data Table in order to fill 2 different comboboxes?

    - by odiseh
    Hi all. I have 2 comboboxes on a form (form1) called combobox1 and combobox2. Each comboboxes should be filled with data stored in 2 different tables in Sql server 2005: table1 and table2 I mean: combobox1 -- table1 combobox2 -- table2 I fill data table with proper data and then bind the comboboxes to it separately. My problem is: after filling 2 combos, both of them have equal data got from table2. This is my code: DataTable tb1 = new DataTable(); //Filling tb1 with data got from table1 combobox1.Items.Clear(); combobox1.DataSource = tb1; combobox1.DisplayMember = "Name"; combobox1.ValueMember = "ID"; combobox1.SelectedIndex = -1; //filling tb1 with data got from table2 combobox2.Items.Clear(); combobox2.DataSource = tb1; combobox2.DisplayMember = "Name"; combobox2.ValueMember = "ID"; combobox2.SelectedIndex = -1; What's wrong? It seems that if I get 2 different data tables (tb1 and tb2) , every thing will be all right. Any suggestions please. Thank you

    Read the article

  • in c# ,one array of class and two connected instance of it why ?

    - by Al0NE
    Hi I wrote the code below : 1. MyClass[] origArr=new MyClass[3]; 2. MyClass[] arr1; 3. // filled the array with objects and did some work on it . 4. dgv_1.DataSource=origArr; 5. 6. // Here is the problem : 7. arr1=origArr; 8. // do some work on arr1 ... 9. dgv_2.DataSource=arr1; For some reason the data in 'origArr' changed when data in 'arr1' change ... I thought that maybe this happened because 'origArr' and 'arr1' are pointers referring to the same object so I changed line '7' to : 7. origArr.CopyTo(arr1,0); but it didn't work ... what can i do to make the pointers referring to different objects?

    Read the article

  • EF in a UserControl can't see the app.config?

    - by Sven
    I just created a user control. This control also makes use of my static Entity Framework class to load two comboboxes. All is well and runs without a problem. Design and runtime are working. Then when I stop the application all the forms that contain my UserControl don't work any more in design time. I just see two errors: Error1: The specified named connection is either not found in the configuration, not intended to be used with the EntityClient provider, or not valid. Error 2: The variable ccArtikelVelden is either undeclared or was never assigned. (ccArtikelVelde is my UserControl) Runtime everything is still working My static EF Repositoy class: public class BSManagerData { private static BSManagerEntities _entities; public static BSManagerEntities Entities { get { if (_entities == null) _entities = new BSManagerEntities(); return _entities; } set { _entities = value; } } } Some logic happening in my UserControl to load the data in the comboboxes: private void LaadCbx() { cbxCategorie.DataSource = (from c in BSManagerData.Entities.Categories select c).ToList(); cbxCategorie.DisplayMember = "Naam"; cbxCategorie.ValueMember = "Id"; } private void cbxCategorie_SelectedIndexChanged(object sender, EventArgs e) { cbxFabrikant.DataSource = from f in BSManagerData.Entities.Fabrikants where f.Categorie.Id == ((Categorie)cbxCategorie.SelectedItem).Id select f; cbxFabrikant.DisplayMember = "Naam"; cbxFabrikant.ValueMember = "Id"; } The only way to make my forms work again, design time, is to comment out the EF part in the UserControl (see above) and rebuild. It's very strange, everything is in the same assembly, same namespace (for the sake of simplicity). Anyone an idea?

    Read the article

  • How do I get 2-way data binding to work for nested asp.net Repeater controls

    - by jimblanchard
    I have the following (trimmed) markup: <asp:Repeater ID="CostCategoryRepeater" runat="server"> <ItemTemplate> <div class="costCategory"> <asp:Repeater ID="CostRepeater" runat="server" DataSource='<%# Eval("Costs")%>'> <ItemTemplate> <tr class="oddCostRows"> <td class="costItemTextRight"><span><%# Eval("Variance", "{0:c0}")%></span></td> <td class="costItemTextRight"><input id="SupplementAmount" class="costEntryRight" type="text" value='<%# Bind("SupplementAmount")%>' runat="server" /></td> </tr> </ItemTemplate> </asp:Repeater> </div> </ItemTemplate> </asp:Repeater> The outer repeater's DataSource is set in the code-beside. I've snipped them, but there are Eval statements that wire up to the properties in the outer Repeater. Anyway, one of the fields in the inner Repeater needs to be a Bind instead of an Eval, as I want to get the values that the user types in. The SupplementAmount input element correctly receives it's value when the page loads, but on the other side, when I inspect the contents of the Costs List when the form posts back, the changes the user made aren't present. Thanks.

    Read the article

  • My treeview Data is Not changing.

    - by Vibin Jith
    Hai , I am trying to display the user permission in a treeview.For each user permissions are stored in the database as xml file. In the page, a Combo box used to list the users and a treeView used to bind the Permission xml. When the user get selected in the combo box , i took the xml from the database and connect with xmlDatasource and bind with the treeView. What happening is , First time the TreeView fill with the xml nodes and another time it will not work. For the first selection it's ok. Anothers selections are not effected by the treeview. The code is debugging. No problem. Can you just tell ,why the treeview datasource is not updating. I used this code .. Dim permissionRoot = From permissionNode In MyUser.UserPermissionXml.Root.Elements("menuNode") XmlTreeViewSource.Data = permissionRoot(0).ToString trvPermission.DataSource = XmlTreeViewSource trvPermission.DataBind() SetPermission(trvPermission.Nodes(0)) The markups <asp:TreeView ID="trvPermission" runat="server" ExpandDepth="2" ShowCheckBoxes="All" ShowLines="True" ForeColor="#005782" > <DataBindings> <asp:TreeNodeBinding DataMember="menuNode" TextField="title" ValueField="value" /> </DataBindings> </asp:TreeView>

    Read the article

  • UpdatePanel reloads the whole page

    - by Emil D
    Hi.I'm building an asp.net cutom control inside which I have two dropdownlists: companyIdSelection and productFamilySelection.I populate the companyIdSelection at Page_Load and in order to populate the productFamilySelection depending on the selected item in companyIdSelection.I'm using UpdatePanels to achieve this, but for some reason every time I update companyIdSelection Page_Load is being called ( which as far as I know should happen only when the entire page is reloaded ), the list is being reloaded again and the item the user selected is lost( the selected item is always the top one ).Here's the code <asp:UpdatePanel ID="updateFamilies" runat="server" UpdateMode="Always"> <ContentTemplate> Company ID:<br> <br></br> <asp:DropDownList ID="companyIdSelection" runat="server" AutoPostBack="True" OnSelectedIndexChanged="companyIdSelection_SelectedIndexChanged"> </asp:DropDownList> <br></br> Product Family: <br></br> <asp:DropDownList ID="productFamilySelection" runat="server" AutoPostBack="True" onselectedindexchanged="productFamilySelection_SelectedIndexChanged"> </asp:DropDownList> <br> </ContentTemplate> </asp:UpdatePanel> protected void Page_Load(object sender, EventArgs e) { this.companyIdSelection.DataSource = companyIds(); //companyIds returns the object containing the initial data items this.companyIdSelection.DataBind(); } protected void companyIdSelection_SelectedIndexChanged(object sender, EventArgs e) { // Page_Load is called again for some reason before this method is called, so it // resets the companyIdSelection EngDbService s = new EngDbService(); productFamilySelection.DataSource = s.getProductFamilies(companyIdSelection.Text); productFamilySelection.DataBind(); } Also, I tried setting the UpdateMode of the UpdatePanel to "Conditional" and adding an asyncpostback trigger but the result was the same. What am I doing wrong? PS: I fixed the updating problem, by using Page.IsPostBack in the Page_Load method, but I would still want to avoid a full postback if possible

    Read the article

  • No event is firing when placing a custom data bound control in DataRepeater control in Windows forms

    - by Remo
    Hi, Custom events in a custom data bound control are not firing in DataRepeater control. When I debug it I found that the DataRepeater Control recreates the control using Activator.CreateInstance and Copies the Properties and Events. In my case copying events doesn't copy the custom events that I hooked in. For example public class MyClass : Control { public event EventHandler MyEvent; protected virtual void OnMyEvent() { if(this.MyEvent != null) { this.MyEvent(this,EventArgs.Empty); } } private int selectedIndex= -1; public int SelectedIndex { get { return this.selectedIndex; } set { if(this.selectedIndex != value) { this.selectedIndex = value; this.OnMyEvent(); } } } // // DataBinding stuff goes here // } public Form1() { InitialiseComponent(); ArrayList list = new ArrayList(); list.Add("one"); this.dataRepeater1.DataSource = list; // One Repeater MyClass test = new Myclass(); test.DataSource = GetDataTable(); this.dataRepeater1.ItemTemplate.Controls.Add(test); test.MyEvent +=new EventHandler(test_MyEvent); } // This Event should fire when selected index of Datatable is changed and is firing when placed directly in the form and not firing when place in DataRepeater control/////////////////////// private void test_MyEvent(object sender, EventArgss e) { // This event is not fired/////////////////////// } private DataTable GetDataTable() { ..// Create a data Table and return } Any help Appreciated. Thanks,

    Read the article

  • Make datalist into 3 x 3

    - by unknown
    This is my code behind for products page. The prodblem is that my datalist will fill in new items whenever I add a new object in the website. So may I know how to add the codes in so that I can make the datalist into 3x3. Thanks. Code behind Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim Product As New Product Dim DataSet As New DataSet Dim pds As New PagedDataSource DataSet = Product.GetProduct Session("Dataset") = DataSet pds.PageSize = 4 pds.AllowPaging = True pds.CurrentPageIndex = 1 Session("Page") = pds If Not Page.IsPostBack Then UpdateDatabind() End If End Sub Sub UpdateDatabind() Dim DataSet As DataSet = Session("DataSet") If DataSet.Tables(0).Rows.Count > 0 Then pds.DataSource = DataSet.Tables(0).DefaultView Session("Page") = pds dlProducts.DataSource = DataSet.Tables(0).DefaultView dlProducts.DataBind() lblCount.Text = DataSet.Tables(0).Rows.Count End If End Sub Private Sub dlProducts_UpdateCommand(source As Object, e As System.Web.UI.WebControls.DataListCommandEventArgs) Handles dlProducts.UpdateCommand dlProducts.DataBind() End Sub Public Sub PrevNext_Command(source As Object, e As CommandEventArgs) Dim pds As PagedDataSource = Session("Page") Dim CurrentPage = pds.CurrentPageIndex If e.CommandName = "Previous" Then If CurrentPage < 1 Or CurrentPage = pds.IsFirstPage Then CurrentPage = 1 Else CurrentPage -= 1 End If UpdateDatabind() ElseIf e.CommandName = "Next" Then If CurrentPage > pds.PageCount Or CurrentPage = pds.IsLastPage Then CurrentPage = CurrentPage Else CurrentPage += 1 End If UpdateDatabind() End If Response.Redirect("Products.aspx?PageIndex=" & CurrentPage) End Sub this is my code for product.vb Public Function GetProduct() As DataSet Dim strConn As String strConn = ConfigurationManager.ConnectionStrings("HomeFurnitureConnectionString").ToString Dim conn As New SqlConnection(strConn) Dim strSql As String 'strSql = "SELECT * FROM Product p INNER JOIN ProductDetail pd ON p.ProdID = pd.ProdID " & _ ' "WHERE pd.PdColor = (SELECT min(PdColor) FROM ProductDetail as pd1 WHERE pd1.ProdID = p.ProdID)" Dim cmd As New SqlCommand(strSql, conn) Dim ds As New DataSet Dim da As New SqlDataAdapter(cmd) conn.Open() da.Fill(ds) conn.Close() Return ds End Function

    Read the article

  • please help me for performing serch in my program

    - by Abid
    i want to perform searching in my programe.. i have my class in which i have made a function i.e. public DataTable Search() { string SQL = "Select * from Customer where " + mField + " like '%" + mValue + "%'"; DataTable dt = new DataTable(); dt = dm.GetData(SQL); return (dt); } in which i have made setters and getters for mField and mValue.. where dm is the object of class Datamanagement in which i have made a function GetData i.e. public DataTable GetData(string SQL) { SqlCommand command = new SqlCommand(); SqlDataAdapter dbAdapter = new SqlDataAdapter(); DataTable DataTable = new DataTable(); command.Connection = clsConnection.GetConnection(); command.CommandText = SQL; dbAdapter.SelectCommand = command; dbAdapter.Fill(DataTable); return (DataTable); } and behind the search button, i have written.. private void btnfind_Click(object sender, EventArgs e) { //cust is the object of class customer// if (tbCustName.Text != "") { cust.Field="CustName"; cust.Value = tbCustName.Text; } else if (tbAddress.Text != "") { cust.Value = tbAddress.Text; cust.Field="Address"; } else if (tbEmail.Text != "") { cust.Value = tbEmail.Text; cust.Field="Email"; } else if (tbCell.Text != "") { cust.Value = tbCell.Text; cust.Field = "Cell"; } DataTable dt = new DataTable(); dt = cust.Search(); dgCustomer.DataSource = dt; RefreshGrid(); } where my referesh grid fuction does that : private void RefreshGrid() { DataTable dt = new DataTable(); dt = cust.GetCustomers(); dgCustomer.DataSource = dt; } but this is not working.. i dont knw y.. please help..

    Read the article

  • How do you bind SQL Data to a .NET DataGridView?

    - by Jordan S
    I am trying to bind a table in an SQL database to a DataGridView Control. I would like to make it so that when the user enters a new line of data in the DataGridView that a record is automatically added to the database. Is there a way to do this using LINQ to SQL? I have tried using the code below but after I add a new entry I dont think the data gets added to the DB. Please Help! BOMClassesDataContext DB = new BOMClassesDataContext(); var mfrs = from m in DB.Manufacturers select m; BindingSource bs = new BindingSource(); bs.DataSource = mfrs; dataGridView1.DataSource = bs; I tried adding DB.SubmitChanges() to the CellValueChanged eventhandler and that partially works. If I click the bottom empty row it automatically fills in the ID (identity) column of the table with a "0" instead of the next unused value. If I change that value manually to the next available then it adds the new record fine but if I leave it at 0 it does nothing. How can i fix this?

    Read the article

  • how run Access 2007 module in Vb6?

    - by Mahmoud
    I have created a module in access 2007 that will update linked tables, but I wanted to run this module from vb6. I have tried this code from Microsoft, but it didnt work. Sub AccessTest1() Dim A As Object Set A = CreateObject("Access.Application") A.Visible = False A.OpenCurrentDatabase (App.Path & "/DataBase/acc.accdb") A.DoCmd.RunMacro "RefreshLinks" End Sub What I am aiming to do, is to allow my program to update all linked tables to new links, in case the program has been used on other computer In case you want to take a look at the module program, here it is: Sub CreateLinkedJetTable() Dim cat As ADOX.Catalog Dim tbl As ADOX.Table Set cat = New ADOX.Catalog ' Open the catalog. cat.ActiveConnection = CurrentProject.Connection Set tbl = New ADOX.Table ' Create the new table. tbl.Name = "Companies" Set tbl.ParentCatalog = cat ' Set the properties to create the link. tbl.Properties("Jet OLEDB:Link Datasource") = CurrentProject.Path & "/db3.mdb" tbl.Properties("Jet OLEDB:Remote Table Name") = "Companies" tbl.Properties("Jet OLEDB:Create Link") = True ' To link a table with a database password set the Link Provider String ' tbl.Properties("Jet OLEDB:Link Provider String") = "MS Access;PWD=Admin;" ' Append the table to the tables collection. cat.Tables.Append tbl Set cat = Nothing End Sub Sub RefreshLinks() Dim cat As ADOX.Catalog Dim tbl As ADOX.Table Set cat = New ADOX.Catalog ' Open the catalog. cat.ActiveConnection = CurrentProject.Connection Set tbl = New ADOX.Table For Each tbl In cat.Tables ' Verify that the table is a linked table. If tbl.Type = "LINK" Then tbl.Properties("Jet OLEDB:Link Datasource") = CurrentProject.Path & "/db3.mdb" ' To refresh a linked table with a database password set the Link Provider String 'tbl.Properties("Jet OLEDB:Link Provider String") = "MS Access;PWD=Admin;" End If Next End Sub

    Read the article

< Previous Page | 42 43 44 45 46 47 48 49 50 51 52 53  | Next Page >