Search Results

Search found 1606 results on 65 pages for 'datasource'.

Page 16/65 | < Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >

  • Gridview sorting: SortDirection always Ascending

    - by Julien N
    Hi ! I have a gridview and I need to sort its elements when the user clicks on the header. Its datasource is a List object. The aspx is defined this way : <asp:GridView ID="grdHeader" AllowSorting="true" AllowPaging="false" AutoGenerateColumns="false" Width="780" runat="server" OnSorting="grdHeader_OnSorting" EnableViewState="true"> <Columns> <asp:BoundField DataField="Entitycode" HeaderText="Entity" SortExpression="Entitycode" /> <asp:BoundField DataField="Statusname" HeaderText="Status" SortExpression="Statusname" /> <asp:BoundField DataField="Username" HeaderText="User" SortExpression="Username" /> </Columns> </asp:GridView> The code behind is defined this way : First load : protected void btnSearch_Click(object sender, EventArgs e) { List<V_ReportPeriodStatusEntity> items = GetPeriodStatusesForScreenSelection(); this.grdHeader.DataSource = items; this.grdHeader.DataBind(); } when the user clicks on headers : protected void grdHeader_OnSorting(object sender, GridViewSortEventArgs e) { List<V_ReportPeriodStatusEntity> items = GetPeriodStatusesForScreenSelection(); items.Sort(new Helpers.GenericComparer<V_ReportPeriodStatusEntity>(e.SortExpression, e.SortDirection)); grdHeader.DataSource = items; grdHeader.DataBind(); } My problem is that e.SortDirection is always set to Ascending. I have webpage with a similar code and it works well, e.SortDirection alternates between Ascending and Descending. What did I do wrong ?

    Read the article

  • GridView doesn't remember state between postbacks

    - by Ryan
    Hi, I have a simple ASP page with databound grid (bound to an object source). The grid is within the page of a wizard and has a 'select' checkbox for each row. In one stage of the wizard, I bind the GridView: protected void Wizard1_NextButtonClick(object sender, WizardNavigationEventArgs e) { ... // Bind and display matches GridViewMatches.EnableViewState = true; GridViewMatches.DataSource = getEmailRecipients(); GridViewMatches.DataBind(); And when the finish button is clicked, I iterate through the rows and check what's selected: protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e) { // Set the selected values, depending on the checkboxes on the grid. foreach (GridViewRow gr in GridViewMatches.Rows) { Int32 personID = Convert.ToInt32(gr.Cells[0].Text); CheckBox selected = (CheckBox) gr.Cells[1].FindControl("CheckBoxSelectedToSend"); But at this stage GridViewMatches.Rows.Count = 0! I don't re-bind the grid, I shouldn't need to, right? I expect the view-state to maintain the state. (Also, if I do rebind the grid, my selection checkboxes will be cleared) NB: This page also dynamically adds user controls in OnInit method. I have heard that it might mess with the view state, but as far as I can tell, I am doing it correctly and the viewstate for those added controls seems to work (values are persisted between postbacks) Thanks a lot in advance for any help! Ryan UPDATE: Could this be to do with the fact I am setting the datasource programatically? I wondered if the asp engine was databinding the grid during the page lifecycle to a datasource that was not yet defined. (In a test page, the GridView is 'automatically' databound'. I don't want the grid to re-bound I just want the values from the viewstate from the previous post! Also, I have this in the asp header: ViewStateEncryptionMode="Never" - this was to resolve an occasional 'Invalid Viewstate Validation MAC' message Thanks again Ryan

    Read the article

  • YUI DataTable with JSON and client side filtering Data Error

    - by user316574
    Hi, I don't understand what I'm doing wrong here ! I keep getting a Data Error. But I validated the JSON and it's ok... Here is the javascript from the YUI Datatble example (slightly modified). <div class="markup"> <label for="filter">Filter by state:</label> <input type="text" id="filter" value=""> <div id="tbl"></div> -- YAHOO.util.Event.addListener(window, "load", function() { //var Ex = YAHOO.namespace('example'); var dataSource = new YAHOO.util.DataSource("jsondb/json_meta_proxy.html",{ responseType : YAHOO.util.DataSource.TYPE_JSON, responseSchema : { resultsList: "records", fields: [ {key:"idprojet"}, {key:"nomprojet"} ], metaFields: { totalRecords: "totalRecords" } }, doBeforeCallback : function (req,raw,res,cb) { // This is the filter function var data = res.results || [], filtered = [], i,l; if (req) { req = req.toLowerCase(); for (i = 0, l = data.length; i and here is the JSON data in the file "jsondb/json_meta_proxy.html" { "recordsReturned": 1, "totalRecords": 1, "startIndex": 0, "sort": "idprojet", "dir": "asc", "records": [ { "idprojet": "11256", "nomprojet": "" } ] } Many thanks for your help !!!

    Read the article

  • Odd Infragistics UltraComboEditor data binding non-bug

    - by Richard Dunlap
    Within an Infragistics 8.2 UltraComboEditor, we had the following properties set via C#: DataSource = dataSource; ValueMember = "Measure"; DisplayMember = "Name"; DataBindings.Add("Value", repository, "Measure"); DataBindings["Value"].DataSourceUpdateMode = DataSourceUpdateMode.OnPropertyChanged; where dataSource was an array of objects, each with a property Measure, and repository was an object with a property Measure. (Those strings are actually constructor parameters -- just using explicit strings to simplify the example.) In the course of some refactoring, the name of the property on the objects in the array was changed to BaseEnum (the objects are actually wrapped enumerations, for the curious), but the name of ValueMember above was not changed. And yet, the combo box binding continued to work through initial testing, beta testing, and even after release... until two customers emailed in noting that the combo box was no longer changing the underlying parameter. We were able to dig out the problem by careful study of the source code repository... despite being in the awkward position of not being able to replicate the buggy behavior internally. Two part question: What's happening under the hood that allowed the binding to continue to function, and/or what might be unique about those two users that caused the binding to (correctly) fail? (O/S version isn't alone the answer, and we get the unexpectedly functioning binding on machines that have never had a version of the software before, so we're not looking at rogue binaries). Are there tools that might have been able to warn us about the misbind, even if something was cleaning up behind?

    Read the article

  • Ado JobStore use!

    - by aleo
    well i'm new in Quartz i'm following this tutorial and i configured my scheduler instance and quartz to use this properties: properties["quartz.jobStore.lockHandler.type"] = "Quartz.Impl.AdoJobStore.UpdateLockRowSemaphore, Quartz"; properties["quartz.jobStore.driverDelegateType"] = "Quartz.Impl.AdoJobStore.SqlServerDelegate, Quartz"; properties["quartz.jobStore.dataSource"] = "default"; properties["quartz.dataSource.default.connectionString"] = "Server=loclahost;Initial Catalog=aleo;Persist Security Info=True;User ID=userid;Password=password"; properties["quartz.dataSource.default.provider"] = "SqlServer-20"; properties["quartz.jobStore.type"] = "Quartz.Impl.AdoJobStore.JobStoreTX, Quartz"; properties["quartz.jobStore.useProperties"] = "true"; properties["quartz.jobStore.tablePrefix"] = "QRTZ_"; ISchedulerFactory schedFact = new Quartz.Impl.StdSchedulerFactory(properties); IScheduler sched = schedFact.GetScheduler(); sched.Start(); but what's next? i am new on C# but if someone explain to can understand :) and my question are how i will add jobs and triggers and stuff to the database? i also created the tables given in the Database/tables folder that comes with Quartz API thanks.

    Read the article

  • LINQ2SQL - Binding result to a grid - want changes to be reflected without re-binding?

    - by Isaac
    Hello, I have a grid (DevExpress XtraGrid, if that matters) which is bound to a LINQ to SQL Entity property. gridItems.DataSource = purchaseOrder.PendingItemsGrouped; Well, the grid is being displayed properly,and I can see the purchase items that are pending. The problem arises when purchaseOrder.PendingItemsGrouped gets changed ... once that happens, the grid does not reflect the changes. The exact procedure is as following: The user selects a row from the grid, inserts a serial number on a specific textbox, and then hits enter effectively receiving this item from the purchase order, and inserting it into stock. inventoryWorker.AddItemToStock( userSelectedItem, serialNumber ); The item gets properly inserted to the inventory, but the grid still shows the item as if it is still awaiting it to be received. How do I solve this problem? Do I really need to re-bind the grid so the changes can be reflected? I even tried instead of: gridItems.DataSource = ...; This: gridItems.DataBindings.Add( new Binding( "DataSource", purchase, "PendingItemsGrouped" ) ); But couldn't solve the problem. Thank you very much for your time, Isaac. OBS: Re-Binding the Grid works, but my question is ... is that even the proper way of doing things? I feel like I'm miles off the right track.

    Read the article

  • Binding Data to DataGridView in VB.Net

    - by Peter
    Hi, I have a bit of code which loads data from a stored procedure in MS SQL Server and then loads the data to a datagridview, which works fine. What i want is for the code that connects / loads the data to sit in my Database Class and then everything associated with the datagridview to be stored in my Form but i am having problems passing the contents of the bindingsource over to the Form from the Database Class. Form1 Public Class Form1 Dim myDatabaseObj As New Class1() Dim bindingSource1 As New BindingSource() Dim connectString As New SqlConnection Dim objDataAdapter As New SqlDataAdapter Dim table As New DataTable() Dim tabletest As New DataTable() Private Sub loadCompanyList() Try Me.dgv_CompanyList.DataSource = Me.bindingSource1 getCompanyList() Catch ex As NullReferenceException End Try End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load loadCompanyList() End Sub End Class Database Class When i try place the getCompanyList() in a class and then create a new object that references the Form() it does not seem to return any value from the table to the MyForm.BindingSource1.Datasource meaning my datagridview displays not data. ..... Private Sub getCompanyList() Try Dim myForm as new Form() connect_Transaction_Database() objDataAdapter.SelectCommand = New SqlCommand() objDataAdapter.SelectCommand.Connection = connectString objDataAdapter.SelectCommand.CommandText = "sp_GetCompanyList" objDataAdapter.SelectCommand.CommandType = CommandType.StoredProcedure Dim commandBuilder As New SqlCommandBuilder(Me.objDataAdapter) Dim table As New DataTable() table.Locale = System.Globalization.CultureInfo.InvariantCulture Me.objDataAdapter.Fill(table) **MyForm.bindingSource1.DataSource = table** Catch ex As DataException MsgBox(ex.Message) Catch ex As NullReferenceException MsgBox(ex.Message) End Try disconnect_Transaction_Database() End Sub If anyone could help. Thank you. Peter

    Read the article

  • Django users and authentication from external source

    - by Boldewyn
    I have a Django app that gets it's data completely from an external source (queried via HTTP). That is, I don't have the option for a local database. Session data is stored in the cache (on my development server I use a SQLite database, so that is no error source). I'm using bleeding edge Django 1.1svn. Enter the problem: I want to use Django's own authentication system for the users. It seems quite simple to write my own Authentication Backend, but always just under the condition that you have a local database where to save the users. Without database my main problem is persistence. I tried it with the following (assume that datasource.get() is a function that returns some kind of dict): class ModelBackend (object): """Login backend.""" def authenticate (self, username=None, password=None): """Check, if a given user/password combination is valid""" data = datasource.get ('login', username, password) if data and data['ok']: return MyUser (username=username) else: raise TypeError return None def get_user (self, username): """get data about a specific user""" try: data = datasource.get ('userdata', username) if data and data['ok']: return data.user except: pass return None class MyUser (User): """Django user who isn't saved in DB""" def save (self): return None But the intentionally missing save() method on MyUser seems to break the session storage of a login. How should MyUser look like without a local database?

    Read the article

  • radgrid insert using radwinow

    - by Hamza
    Hello Everybody, The company details page in my system has a user control to show the founders of the company, that user control represents the founders by using a Rad Grid and three buttons for insert/edit/delete founders, the founders grid is being bind by using a WCF service. the insert button calls a javascript method that opens a Rad Window in which the user can insert the data for a new founder my problem is: in the Add Founder Rad Window I shouldn't save the new founder in the database, when I press Add the Rad Grid should be closed and the new founder should be added to the founders Grid's datasource, and then the grid should be bind again the questions is: what is the best way to do that, I don't want to use sessions nor json, I tried to use another wcf service which takes two parameters: reference to the grid and the new founder, and in this wcf service I get the old datasource then add the new founder to it and finally rebind the grid again, but I have faced some problems like how can I send the reference to the grid from javascript method to a WCF service, also if I add more than one founder how can keep track of the new founders and the original datasource if any of you can lead me to an example similar to my case this would be very much appreciated, also any comments and feedback are most welcomed

    Read the article

  • DatagGridViewColumn.DataPropertyName to an array element?

    - by unknown
    Hi there, I'm using a DataGridView binding its datasource to a List, and specifying the properties for each column. An example would be: DataGridViewTextBoxColumn colConcept = new DataGridViewTextBoxColumn(); DataGridViewCell cell4 = new DataGridViewTextBoxCell(); colConcept.CellTemplate = cell4; colConcept.Name = "concept"; colConcept.HeaderText = "Concept"; colConcept.DataPropertyName = "Concept"; colConcept.Width = 200; this.dataGridViewBills.Columns.Add(colConcept); {... assign other colums...} And finally this.dataGridViewBills.DataSource=billslist; //billslist is List<Bill> Obviously Class Bill has a Property called Concept, as well as one Property for each column. Well, now my problem, is that Bill should have and Array/List/whateverdynamicsizecontainer of strings called Years. Let's assume that every Bill will have the same Years.Count, but this only known at runtime.Thus, I can't specify properties like Bill.FirstYear to obtain Bill.Years[0], Bill.SecondYear to obtain Bills.Years[1]... etc... and bind it to each column. The idea, is that now I want to have a grid with dynamic number of colums (known at runtime), and each column filled with a string from the Bill.Years List. I can make a loop to add columns to the grid at runtime depending of Bill.Years.Count, but is possible to bind them to each of the strings that the Bill.Years List contains??? I'm not sure if I'm clear enough. The result ideally would be something like this, for 2 bills on the list, and 3 years for each bill: --------------------------------------GRID HEADER------------------------------- NAME CONCEPT YEAR1 YEAR2 YEAR3 --------------------------------------GRID VALUES------------------------------- Bill1 Bill1.Concept Bill1.Years[0] Bill1.Years[1] Bill1.Years[2] Bill2 Bill2.Concept Bill2.Years[0] Bill2.Years[1] Bill2.Years[2] I can always forget the datasource, and write each cell manually, as the MSFlexGrid used to like, but if possible, I would like to use the binding capabilities of the DataGridView. Any ideas? Thanks a lot.

    Read the article

  • iPhone SDK: Progressive UITableView updates, smoothly animated

    - by boliva
    Hi all, There's something I've been trying to do with no success. I have an UITableView whose viewController is both its delegate and dataSource. On it I also have a mutableArray as a property, which basically acts as the tableView dataSource. This mutableArray gets continously updated from an online XML source. What I haven't been able to accomplish successfully is to animate the adding of new rows at the top of the tableView and the deletion of the oldest rows at its bottom (thinking I'll always going to show the same amount of data, say the latest 10 entries). The method I'm actually using is that, after finishing receiving and parsing the XML data I'm removing all the contents of the mutableArray and storing the new entries on it, to later reload the tableView (calling the 'reloadData' method). In between I'm using a CATransition in order to 'fade' the tableView from its previous to its new state. I tried using beginUpdates and endUpdates, with code for selectively removing the old rows from the tableView and adding the new ones to it, as well as to its datasource, however the animation takes place in the whole table instead of the affected rows only. What I want to accomplish is, after an update, to delete as many rows from the 'bottom' of the table as new entries I have retrieved, sliding the tableView down and adding the new rows at the top of it, smoothly animated. Best regards,

    Read the article

  • How can I create a SQL table using excel columns?

    - by Phsika
    I need to help to generate column name from excel automatically. I think that: we can do below codes: CREATE TABLE [dbo].[Addresses_Temp] ( [FirstName] VARCHAR(20), [LastName] VARCHAR(20), [Address] VARCHAR(50), [City] VARCHAR(30), [State] VARCHAR(2), [ZIP] VARCHAR(10) ) via C#. How can I learn column name from Excel? private void Form1_Load(object sender, EventArgs e) { ExcelToSql(); } void ExcelToSql() { string connectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Source\MPD.xlsm;Extended Properties=""Excel 12.0;HDR=YES;"""; // if you don't want to show the header row (first row) // use 'HDR=NO' in the string string strSQL = "SELECT * FROM [Sheet1$]"; OleDbConnection excelConnection = new OleDbConnection(connectionString); excelConnection.Open(); // This code will open excel file. OleDbCommand dbCommand = new OleDbCommand(strSQL, excelConnection); OleDbDataAdapter dataAdapter = new OleDbDataAdapter(dbCommand); // create data table DataTable dTable = new DataTable(); dataAdapter.Fill(dTable); // bind the datasource // dataBingingSrc.DataSource = dTable; // assign the dataBindingSrc to the DataGridView // dgvExcelList.DataSource = dataBingingSrc; // dispose used objects if (dTable.Rows.Count > 0) MessageBox.Show("Count:" + dTable.Rows.Count.ToString()); dTable.Dispose(); dataAdapter.Dispose(); dbCommand.Dispose(); excelConnection.Close(); excelConnection.Dispose(); }

    Read the article

  • Can not find Driver when using generic database bundle

    - by Marc
    I have a project that is build up from several OSGi bundles. One of them is a generic Database bundle that defines a DataSource that can be used throughout the project. The spring bean definition of this service is: <osgi:service interface="javax.sql.DataSource"> <bean class="org.postgresql.ds.PGPoolingDataSource"> <property name="databaseName" value="xxx" /> <property name="serverName" value="xxx" /> <property name="user" value="xxx" /> <property name="password" value="xxx" /> </bean> </osgi:service> Now, when using this DataSource is a different bundle, we get an error: No suitable driver found for jdbc:postgresql://localhost/xxx I have tried the following to add the org.postgresql.Driver to the DriverManager: Instantiated an empty bean for that Driver in the spring context, like this: <bean class="org.postgresql.Driver" /> Instantiated the Driver statically in one of the classes, like this: Class.forName("org.postgresql.Driver"); Added a file META-INF\services\java.sql.Driver with the content org.postgresql.Driver None of these solutions seems to help.

    Read the article

  • Update database settings in properties file in Spring

    - by mvg
    Hi all, I am trying to create a Database Manager page which shows the database details on page load and updates the database settings when the user press submit I followed this tutorial and set the database settings in properties file. I managed to update the database settings in properties file programmatically. When I retrieved the database settings using the following code DriverManagerDataSource databaseSource = (DriverManagerDataSource)context.getBean("dataSource"); databaseSource.getUsername(); I managed to get the old value and unable to get the new value This is the mapping in applicationContext.xml file <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="location"> <value>classpath:/bundle/database.properties</value> </property> </bean> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${jdbc.driverClassName}" /> <property name="url" value="${jdbc.url}" /> <property name="username" value="${jdbc.username}" /> <property name="password" value="${jdbc.password}" /> </bean> I checked the properties file and found it to be updated with the latest input. What am I missing? Thanks in advance P.S I am using JSF1.2 with Spring 3 Update Just making my requirement simple. I am creating a setparate dbsettings page, so that when user wishes to connect to different database he/she can just enter the details in dbsettings page and connect

    Read the article

  • How can you connect to a password protected MS Access Database from a Spring JdbcTemplate?

    - by Tim Visher
    I need to connect to a password protected MS Access 2003 DB using the JDBC-ODBC bridge. I can't find out how to specify the password in the connect string, or even if that is the correct method of connecting. It would probably be relevant to mention that this is a Spring App which is accessing the database through a JdbcTemplate configured as a datasource bean in our application context file. Some relevant snippets: from application-context.xml <bean id="jdbcTemplate" class="org.springframework.jdbc.core.JdbcTemplate"> <property name="dataSource" ref="legacyDataSource" /> </bean> <bean id="jobsheetLocation" class="java.lang.String"> <constructor-arg value="${jobsheet.location}"/> </bean> <bean id="legacyDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${jdbc.legacy.driverClassName}" /> <property name="url" value="${jdbc.legacy.url}"/> <property name="password" value="-------------" /> </bean> from our build properties jdbc.legacy.driverClassName=sun.jdbc.odbc.JdbcOdbcDriver jdbc.legacy.url=jdbc:odbc:Driver\={Microsoft Access Driver (*.mdb)};Dbq\=@LegacyDbPath@;DriverID\=22;READONLY\=true Any thoughts?

    Read the article

  • oracle hibernate + maven dependenciesm dbcp.basicdatasource exception

    - by Joe
    I'm trying to create a web application using maven, tomcat and hibernate. Now I'm getting a cannot find class for org.appache.commons.dbcp.basicdatasource for bean with name datasource... exception. Without the hibernate aspects it works fine, but if I add <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.Oracle10gDialect</prop> <prop key="hibernate.hbm2ddl.auto">create</prop> <prop key="hibernate.show_sql">true</prop> </props> </property> <property name="mappingResources"> <list> </list> </property> </bean> to my applicationContext then I get the error. What I did was: -add org.hibernate to my pom -put ojdbc16.jar in my tomcat bin folder -add the above snippet to my applicationContext.xml I use a bat file to compile my project (using maven), copy it to my tomcat webapp folder and to start the server. Any input on what I'm doing wrong is welcome.

    Read the article

  • TabHost disappears after locking the phone and reopening it:

    - by Emil Adz
    I have a weird issue with my TabHost in my FragmentActivity that contains a ViewPager. The problem is that when I close my phone (press the power button) while I use my application, and then I turn back the phone and my application gets reopened, at this point my TabHost is missing. So the closing of my phone is causes the TabHost to disappear. My guess would be that I need to save my tabHost state in the saveInstanceState object, and restore it in onResume I only have no idea how it's done. here is my code for the FragmentActivity: public class TabsViewPagerFragmentActivity extends FragmentActivity implements ViewPager.OnPageChangeListener, TabHost.OnTabChangeListener { static final String TAG = TabsViewPagerFragmentActivity.class.getSimpleName(); private TabHost mTabHost; private ViewPager mViewPager; private HashMap<String, TabInfo> mapTabInfo; public ViewPagerAdapter mPagerAdapter; private TextView tvReportName, tvTabTitle; private Button bBackToParameters; private Dialog progressDialog; private SGRaportManagerAppObj application; private int numberOfTabs = 0; private Display display; public static final int POPUP_MARGIN = 6; LeftSideMenu leftSideMenu; public void NotifyTabActivityViewPagerAdapter() { mPagerAdapter.notifyDataSetChanged(); } public ViewPagerAdapter getTabActivityViewPagerAdapter() { return mPagerAdapter; } public ViewPager getTabActivityViewPager() { return mViewPager; } public void setCurrentTabTitle (String title) { tvTabTitle.setText(title); Log.d(TAG, "set tab title from activity: "+title); } /** * Maintains extrinsic info of a tab's construct */ private class TabInfo { private String tag; private Class<?> clss; private Bundle args; private Fragment fragment; TabInfo(String tag, Class<?> clazz, Bundle args) { this.tag = tag; this.clss = clazz; this.args = args; } } /** * A simple factory that returns dummy views to the Tabhost */ class TabFactory implements TabContentFactory { private final Context mContext; /** * @param context */ public TabFactory(Context context) { mContext = context; } /** (non-Javadoc) * @see android.widget.TabHost.TabContentFactory#createTabContent(java.lang.String) */ public View createTabContent(String tag) { View v = new View(mContext); v.setMinimumWidth(0); v.setMinimumHeight(0); return v; } } /** (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onCreate(android.os.Bundle) */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); application = SGRaportManagerAppObj.getInstance(); display = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); // Inflate the layout setContentView(R.layout.tabs_screen_activity_layout); tvTabTitle = (TextView) findViewById(R.id.tvTabName); tvReportName = (TextView)findViewById(R.id.tvReportName); tvReportName.setText(application.currentReport.getName()+ " - "); bBackToParameters = (Button) findViewById(R.id.bBackToParameters); leftSideMenu = (LeftSideMenu) findViewById(R.id.leftSideMenu); applyOnClickListenerToLeftSideMenu(); findViewById(R.id.showLeftMenuButton).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Display d = ((WindowManager)getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay(); int width = d.getWidth(); View panel = findViewById(R.id.leftSideMenu); View appPanel = findViewById(R.id.appLayout); if (panel.getVisibility() == View.GONE){ appPanel.setLayoutParams(new LinearLayout.LayoutParams(width, LayoutParams.FILL_PARENT)); panel.setVisibility(View.VISIBLE); applyOnClickListenerToLeftSideMenu(); }else{ ToggleButton button = (ToggleButton) findViewById(R.id.showLeftMenuButton); button.setChecked(false); panel.setVisibility(View.GONE); } } }); // Initialise the TabHost progressDialog = DialogUtils.createProgressDialog(this, this.getString(R.string.populating_view_pager)); progressDialog.show(); if (SGRaportManagerAppObj.getInstance().parametersRepository.getParametersRepository().size() == 0) { bBackToParameters.setText(R.string.back_to_report_list); } this.initialiseTabHost(savedInstanceState); if (savedInstanceState != null) { mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab")); //set the tab as per the saved state } // Intialise ViewPager this.intialiseViewPager(); progressDialog.dismiss(); } /** (non-Javadoc) * @see android.support.v4.app.FragmentActivity#onSaveInstanceState(android.os.Bundle) */ protected void onSaveInstanceState(Bundle outState) { outState.putString("tab", mTabHost.getCurrentTabTag()); //save the tab selected super.onSaveInstanceState(outState); } /** * Initialise ViewPager */ public void intialiseViewPager() { List<Fragment> fragments = new Vector<Fragment>(); // TabInfo tabInfo = null; if (application.getCurrentDataSource().equals(DataSource.SSRS)) { numberOfTabs = application.currentReport.getTabsList().size(); } else if (application.getCurrentDataSource().equals(DataSource.SGRDL)) { numberOfTabs = application.currentReport.getODTabsList().size(); Log.d(TAG, "CURRENT REPORT FROM VIEW PAGER: "+ application.currentReport.toString()); } Log.d(TAG,"Current Tabs number from TabsViewPager activity: " +numberOfTabs); if (application.getCurrentDataSource().equals(DataSource.SSRS)) { for (int i = 0; i < numberOfTabs; i++) { Tab tempTab = application.currentReport.getTabsList().get(i); if (tempTab.getTabTemplateId() == 7) { GridFragment gridFragment = new GridFragment(tempTab); fragments.add(gridFragment); } else if (tempTab.getTabTemplateId() == 8) { NewChartFragment chartFragment = new NewChartFragment(tempTab, this); fragments.add(chartFragment); } } } else if (application.getCurrentDataSource().equals(DataSource.SGRDL)) { for (int i = 0; i < numberOfTabs; i++) { ODTab tempTab = application.currentReport.getODTabsList().get(i); if (tempTab.getTabType().equals(ODGrid.XML_GRID_ELEMENT)) { GridFragment gridFragment = GridFragment.newInstance(tempTab.getTabId()); fragments.add(gridFragment); } else if (tempTab.getTabType().equals(ODChart.XML_CHART_ELEMENT)) { NewChartFragment chartFragment = NewChartFragment.newInstance(tempTab.getTabId()); fragments.add(chartFragment); } } } Log.d(TAG, "Current report fragments set to adapter: "+fragments.toString()); /* if (this.mPagerAdapter == null) { this.mPagerAdapter = new ViewPagerAdapter(super.getSupportFragmentManager(), fragments); } else { this.mPagerAdapter.removeAllFragments(); this.mPagerAdapter.addFragmentsListToAdapter(fragments); } */ this.mPagerAdapter = new ViewPagerAdapter(super.getSupportFragmentManager(), fragments); this.mViewPager = (ViewPager)super.findViewById(R.id.pager); // this.mViewPager.setAdapter(null); this.mViewPager.setAdapter(this.mPagerAdapter); this.mViewPager.setOffscreenPageLimit(0); this.mViewPager.setOnPageChangeListener(this); Log.d(TAG, "Adapter initialized!"); } /** * Initialise the Tab Host */ public void initialiseTabHost(Bundle args) { mTabHost = (TabHost)findViewById(android.R.id.tabhost); /* //new edit if (mTabHost.getChildCount() > 0) { mTabHost.removeAllViews(); } */ mTabHost.setup(); TabInfo tabInfo = null; mapTabInfo = new HashMap<String, TabsViewPagerFragmentActivity.TabInfo>(); if (args != null) {} else { if (application.getCurrentDataSource().equals(DataSource.SSRS)) { int numberOfTabs = application.currentReport.getTabsList().size(); for (int i = 0; i < numberOfTabs; i++) { Tab tempTab = application.currentReport.getTabsList().get(i); if (tempTab.getTabTemplateId() == 7) { //GridFragment gridFragment = new GridFragment(tempTab); TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), GridFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } else if (tempTab.getTabTemplateId() == 8) { TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), NewChartFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } } } else if (application.getCurrentDataSource().equals(DataSource.SGRDL)) { int numberOfTabs = application.currentReport.getODTabsList().size(); for (int i = 0; i < numberOfTabs; i++) { ODTab tempTab = application.currentReport.getODTabsList().get(i); // Log.d(TAG,"Crashed Tab type: "+ tempTab.getTabType()); if (tempTab.getTabType().equals(ODGrid.XML_GRID_ELEMENT)) { //GridFragment gridFragment = new GridFragment(tempTab); TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), GridFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } else if (tempTab.getTabType().equals(ODChart.XML_CHART_ELEMENT)) { TabsViewPagerFragmentActivity.AddTab(this, this.mTabHost, this.mTabHost.newTabSpec("Tab "+String.valueOf(i)).setIndicator("Tab "+String.valueOf(i)), ( tabInfo = new TabInfo("Tab "+String.valueOf(i), NewChartFragment.class, args))); this.mapTabInfo.put(tabInfo.tag, tabInfo); } } } } // Default to first tab //this.onTabChanged("Tab1"); // mTabHost.setOnTabChangedListener(this); } /** * Add Tab content to the Tabhost * @param activity * @param tabHost * @param tabSpec * @param clss * @param args */ private static void AddTab(TabsViewPagerFragmentActivity activity, TabHost tabHost, TabHost.TabSpec tabSpec, TabInfo tabInfo) { // Attach a Tab view factory to the spec ImageView indicator = new ImageView(activity.getBaseContext()); indicator.setPadding(10, 10, 10, 10); indicator.setImageResource(R.drawable.tab_select_icon_selector); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT); lp.setMargins(10, 10, 10, 10); indicator.setLayoutParams(lp); tabSpec.setIndicator(indicator); tabSpec.setContent(activity.new TabFactory(activity)); tabHost.addTab(tabSpec); } /** (non-Javadoc) * @see android.widget.TabHost.OnTabChangeListener#onTabChanged(java.lang.String) */ public void onTabChanged(String tag) { //TabInfo newTab = this.mapTabInfo.get(tag); int pos = this.mTabHost.getCurrentTab(); this.mViewPager.setCurrentItem(pos); } /* (non-Javadoc) * @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageScrolled(int, float, int) */ @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { // TODO Auto-generated method stub } /* (non-Javadoc) * @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageSelected(int) */ @Override public void onPageSelected(int position) { // TODO Auto-generated method stub this.mTabHost.setCurrentTab(position); } /* (non-Javadoc) * @see android.support.v4.view.ViewPager.OnPageChangeListener#onPageScrollStateChanged(int) */ @Override public void onPageScrollStateChanged(int state) { // TODO Auto-generated method stub } How would one save the state of the TabHost and restore it in onResume? Any help would be very appreciated.

    Read the article

  • Help with interesting VS2010 and SQL2008 bug

    - by user355770
    Hey So im using Visual Studio 2010 to create a webpage. im calling some tabels from sql server 2008 here is where im confused... The code runs fine no errors. The pages works except im missing my rows in my 3rd column from the table. Everything else shows up. Ive checked to make sure the names are matching everywhere and that in sql the joins and such worked. Its just very weird that i'd be missing my 2 rows from the 3rd column. anyone have any ideas to help?? the error is in the tab called research material else if (tabTagId == "tpArlington_ProjectInformation") { repArlington_ProjectInformation.DataSource = ds; repArlington_ProjectInformation.DataBind(); } else if (tabTagId == "tpArlington_Plan") { repArlington_Plan.DataSource = ds; repArlington_Plan.DataBind(); } else if (tabTagId == "tpArlington_ResearchMaterial") { repArlington_ResearchMaterial.DataSource = ds; repArlington_ResearchMaterial.DataBind(); } else if (Session["projectAbbreviation"].ToString() == "ARLING") { tpArlington_ProjectInformation.HeaderText = "Project Information"; tpArlington_ProjectInformation.Visible = true; tpArlington_Plan.HeaderText = "Plan"; tpArlington_Plan.Visible = true; tpArlington_ResearchMaterial.HeaderText = "ResearchMaterial"; tpArlington_ResearchMaterial.Visible = true; getTabData("tpArlington_ProjectInformation"); getTabData("tpArlington_Plan"); getTabData("tpArlington_ReasearchMaterial"); } the 2 other tabs work perfect. the research material is where the problem is. the stuff in the tab doesn't come up. the text in the tab DOES come up but not the stuff from sql. the stuff in sql looks good, the ids match and everything is joined properly otherwise the other 2 tabs wouldnt work. that is what is confusing me. any suggestions or specific info you need just ask. thanks!

    Read the article

  • Telerik RadGrid: grid clientside pagination

    - by ram
    I have a web service which returns me some data,I am massaging this data and using this as datasource for my radgrid (telerik). The datasource is quite large, and would like to paginate it. I found couple of problems when I paginate it in the server side I have to bind the grid again for pagination, which essentially means I have to make a call to WS again to get the data. This is an expensive call for me. I would rather forgo the benefits of pagination and would display all the results in the same page, except for it would be a bit clumsy During the postback RadGrid1.Items.Count happens to be the number of items getting paginated (25- in my case) which is expected as all the items in the datasource are not getting bound. This of course is not an issue. The real issue is that we have some checkboxes which get checked based on some business condition. We add this to our business object/DB later. So if the user has not navigated all the pages, these "checked" items do not get added as pagination limits the "Items" in the grid to those which get bound for that particular page index. My Thoughts: I would rather have some sort of client side pagination, where we can hide/show contents than going to the server and doing a databind every time. Though it will return all the results, the UI will not be clumsy and the grid would have "all the items" during postback Is there a way to do it ? If it were a regular asp.net gridView, can someone point me to a good article which would serve my purpose Ram PS: who else think radgrid is crazy ? (unfortunately I did not make this choice)

    Read the article

  • Something wrong on my very first LINQ to SQL c # code

    - by user334813
    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace Advanced_LinQ_Query { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private DataClasses1DataContext database = new DataClasses1DataContext(); private void Form1_Load(object sender, EventArgs e) { database.Log= Console.Out; comboBox.SelectedIndex=0; } private void titleBindingNavigatorSaveItem_Click(object sender, EventArgs e) { Validate(); titleBindingSource.EndEdit(); database.SubmitChanges(); comboBox.SelectedIndex=0; } private void comboBox_SelectedIndexChanged(object sender, EventArgs e) { switch (comboBox.SelectedIndex) { case 0: titleBindingSource.DataSource = from Title in database.Titles orderby Title.BookTitle select Title; break; case 1: titleBindingSource.DataSource = from Title in database.Titles where Title.Copyright == "2008" orderby Title.BookTitle select Title; break; case 2: titleBindingSource.DataSource = from Title in database.Titles where Title.BookTitle.EndsWith("How to Program") orderby Title.BookTitle select Title; break; } titleBindingSource.MoveFirst(); } } } no connection seems to built after debugging between Title table in my database (book.mdf) and titleBindingSource! Where is the problem?

    Read the article

  • Report Builder 2.0 - Creating DataSet - User Not Authorized

    - by Fahad
    Hello, we are currently using SQL Server Reporting Services and we would like to use Report Builder so our customers can create reports themselves. I have created a User on the server. I have added this user to the SQLServerMSSQLUser and SQLServerReportServerUser groups. I have given this User db_datareader access to the required database and to the Reporting Services database. I've also tried giving the User db_owner access to the Reporting Services db's. And on the Report Manager, this User is a System_User, but has all access (every checkbox is checked). When I connect using Report Builder, I can select the Report Model to create a DataSource, but when I try to create a DataSet, I get the following error: An error occurred while connection to datasource 'DataSource1'. The details are: 'User Not Authorized'. Does anyone know what server permissions I forgot to set? I'm assuming it's a Windows permissions issue because I do not see any database login errors in the event logs.

    Read the article

  • C# asp.net EF MVC postgresql error 23505: Duplicate key violates unique constraint

    - by user2721755
    EDIT: It was issue with database table - dropping and recreating table id column did the work. Problem solved. I'm trying to build web application, that is connected to postgresql database. Results are displaying in view with Kendo UI. When I'm trying to add new row (with Kendo UI 'Add new record' button), I get error 23505: 'Duplicate key violates unique constraint'. My guess is, that EF takes id to insert from the beginning, not the last one, because after 35 (it's number of rows in table) tries - and errors - adding works perfectly. Can someone help me to understand, what's wrong? Model: using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; namespace MainConfigTest.Models { [Table("mainconfig", Schema = "public")] public class Mainconfig { [Column("id")] [Key] [Editable(false)] public int Id { get; set; } [Column("descr")] [Editable(true)] public string Descr { get; set; } [Column("hibversion")] [Required] [Editable(true)] public long Hibversion { get; set; } [Column("mckey")] [Required] [Editable(true)] public string Mckey { get; set; } [Column("valuexml")] [Editable(true)] public string Valuexml { get; set; } [Column("mcvalue")] [Editable(true)] public string Mcvalue { get; set; } } } Context: using System.Data.Entity; namespace MainConfigTest.Models { public class MainConfigContext : DbContext { public DbSet<Mainconfig> Mainconfig { get; set; } } } Controller: namespace MainConfigTest.Controllers { public class MainConfigController : Controller { #region Properties private Models.MainConfigContext db = new Models.MainConfigContext(); private string mainTitle = "Mainconfig (Kendo UI)"; #endregion #region Initialization public MainConfigController() { ViewBag.MainTitle = mainTitle; } #endregion #region Ajax [HttpGet] public JsonResult GetMainconfig() { int take = HttpContext.Request["take"] == null ? 5 : Convert.ToInt32(HttpContext.Request["take"]); int skip = HttpContext.Request["skip"] == null ? 0 : Convert.ToInt32(HttpContext.Request["skip"]); Array data = (from Models.Mainconfig c in db.Mainconfig select c).OrderBy(c => c.Id).ToArray().Skip(skip).Take(take).ToArray(); return Json(new Models.MainconfigResponse(data, db.Mainconfig.Count()), JsonRequestBehavior.AllowGet); } [HttpPost] public JsonResult Create() { try { Mainconfig itemToAdd = new Mainconfig() { Descr = Convert.ToString(HttpContext.Request["Descr"]), Hibversion = Convert.ToInt64(HttpContext.Request["Hibversion"]), Mckey = Convert.ToString(HttpContext.Request["Mckey"]), Valuexml = Convert.ToString(HttpContext.Request["Valuexml"]), Mcvalue = Convert.ToString(HttpContext.Request["Mcvalue"]) }; db.Mainconfig.Add(itemToAdd); db.SaveChanges(); return Json(new { Success = true }); } catch (InvalidOperationException ex) { return Json(new { Success = false, msg = ex }); } } //other methods } } Kendo UI script in view: <script type="text/javascript"> $(document).ready(function () { $("#config-grid").kendoGrid({ sortable: true, pageable: true, scrollable: false, toolbar: ["create"], editable: { mode: "popup" }, dataSource: { pageSize: 5, serverPaging: true, transport: { read: { url: '@Url.Action("GetMainconfig")', dataType: "json" }, update: { url: '@Url.Action("Update")', type: "Post", dataType: "json", complete: function (e) { $("#config-grid").data("kendoGrid").dataSource.read(); } }, destroy: { url: '@Url.Action("Delete")', type: "Post", dataType: "json" }, create: { url: '@Url.Action("Create")', type: "Post", dataType: "json", complete: function (e) { $("#config-grid").data("kendoGrid").dataSource.read(); } }, }, error: function (e) { if(e.Success == false) { this.cancelChanges(); } }, schema: { data: "Data", total: "Total", model: { id: "Id", fields: { Id: { editable: false, nullable: true }, Descr: { type: "string"}, Hibversion: { type: "number", validation: {required: true,}, }, Mckey: { type: "string", validation: { required: true, }, }, Valuexml:{ type: "string"}, Mcvalue: { type: "string" } } } } }, //end DataSource // generate columns etc. Mainconfig table structure: id serial NOT NULL, descr character varying(200), hibversion bigint NOT NULL, mckey character varying(100) NOT NULL, valuexml character varying(8000), mcvalue character varying(200), CONSTRAINT mainconfig_pkey PRIMARY KEY (id), CONSTRAINT mainconfig_mckey_key UNIQUE (mckey) Any help will be appreciated.

    Read the article

  • Cocoa QuickLook initiated by NSTableView Cell

    - by Tristan Seifert
    I have an NSTableView that contains 2 different Columns - one is an NSImageCell that shows a file icon, and the second is a custom subclass of NSTextFieldCell that contains a quick look button on the right of the text. When I click the Quick Look button, the following code is invoked: [[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil]; This does it's job and shows the blank Quick Look panel saying "No Items Selected." After I did a bit of research on the internet, I implemented a custom NSTableView subclass to be the Delegate and Data Source for the Quick Look panel. I get the notification that Quick Look asks if I want to be the delegate, and I respond with return YES. Even though I implement all methods in both QLPreviewPanelDataSource and QLPreviewPanelDelegate, at runtime I get this error on the console: 2010-12-24 15:32:17.235 BackMeUp[4763:80f] clicked: ~/Desktop/HUDTape.mov 2010-12-24 15:32:17.489 BackMeUp[4763:80f] [QL] QLError(): -[QLPreviewPanel setDelegate:] called while the panel has no controller - Fix this or this will raise soon. See comments in QLPreviewPanel.h for -acceptsPreviewPanelControl:/-beginPreviewPanelControl:/-endPreviewPanelControl:. 2010-12-24 15:32:17.490 BackMeUp[4763:80f] [QL] QLError(): -[QLPreviewPanel setDataSource:] called while the panel has no controller - Fix this or this will raise soon. See comments in QLPreviewPanel.h for -acceptsPreviewPanelControl:/-beginPreviewPanelControl:/-endPreviewPanelControl:. 2010-12-24 15:32:17.491 BackMeUp[4763:80f] We can now receive QL Events. 2010-12-24 15:32:18.291 BackMeUp[4763:80f] -[NSPathStore2 stringValue]: unrecognized selector sent to instance 0x5ecb10 2010-12-24 15:32:18.292 BackMeUp[4763:80f] -[NSPathStore2 stringValue]: unrecognized selector sent to instance 0x5ecb10 And the Quick Look panel does not show up, which I find rather odd. The first line above is just that I know the cell has been clicked. Anyways, here is the .m file of the custom table view subclass: // // BackupListTableView.m // BackMeUp // // Created by Tristan Seifert on 12/24/10. // Copyright 2010 24/7 Server. All rights reserved. // #import "BackupListTableView.h" @implementation BackupListTableView - (void) awakeFromNib { } // Quick Look Delegates - (BOOL)acceptsPreviewPanelControl:(QLPreviewPanel *)panel; { [QLPreviewPanel sharedPreviewPanel].delegate = self; [QLPreviewPanel sharedPreviewPanel].dataSource = self; NSLog(@"We can now receive QL Events."); return YES; } - (void)beginPreviewPanelControl:(QLPreviewPanel *)panel { // This document is now responsible of the preview panel // It is allowed to set the delegate, data source and refresh panel. [QLPreviewPanel sharedPreviewPanel].delegate = self; [QLPreviewPanel sharedPreviewPanel].dataSource = self; } - (void)endPreviewPanelControl:(QLPreviewPanel *)panel { // This document loses its responsisibility on the preview panel // Until the next call to -beginPreviewPanelControl: it must not // change the panel's delegate, data source or refresh it. return; } // Quick Look panel data source - (NSInteger)numberOfPreviewItemsInPreviewPanel:(QLPreviewPanel *)panel { return 1; } - (id <QLPreviewItem>)previewPanel:(QLPreviewPanel *)panel previewItemAtIndex:(NSInteger)index { int selectedRow = [self selectedRow]; return [NSURL URLWithString:[[[self dataSource] tableView:self objectValueForTableColumn:fileColumn row:selectedRow] stringValue]]; } // Quick Look panel delegate - (BOOL)previewPanel:(QLPreviewPanel *)panel handleEvent:(NSEvent *)event { // redirect all key down events to the table view return NO; } // This delegate method provides the rect on screen from which the panel will zoom. - (NSRect)previewPanel:(QLPreviewPanel *)panel sourceFrameOnScreenForPreviewItem:(id <QLPreviewItem>)item { NSRect iconRect = [self rectOfColumn:1]; /* // check that the icon rect is visible on screen NSRect visibleRect = [self visibleRect]; // convert icon rect to screen coordinates iconRect = [self convertRectToBase:iconRect]; iconRect.origin = [[self window] convertBaseToScreen:iconRect.origin]; */ return iconRect; } // This delegate method provides a transition image between the table view and the preview panel - (id)previewPanel:(QLPreviewPanel *)panel transitionImageForPreviewItem:(id <QLPreviewItem>)item contentRect:(NSRect *)contentRect { int selectedRow = [self selectedRow]; NSImage *fileIcon = [[NSWorkspace sharedWorkspace] iconForFile:[[[self dataSource] tableView:self objectValueForTableColumn:fileColumn row:selectedRow] stringValue]]; return fileIcon; } @end Thanks for any help.

    Read the article

  • Spring / Hibernate / JUnit - No Hibernate Session bound to Thread

    - by Marty Pitt
    Hi I'm trying to access the current hibernate session in a test case, and getting the following error: org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63) at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:574) I've clearly missed some sort of setup, but not sure what. Any help would be greatly appreciated. This is my first crack at Hibernate / Spring etc, and the learning curve is certainly steep! Regards Marty Code follows: The offending class: public class DbUnitUtil extends BaseDALTest { @Test public void exportDtd() throws Exception { Session session = sessionFactory.getCurrentSession(); session.beginTransaction(); Connection hsqldbConnection = session.connection(); IDatabaseConnection connection = new DatabaseConnection(hsqldbConnection); // write DTD file FlatDtdDataSet.write(connection.createDataSet(), new FileOutputStream("test.dtd")); } } Base class: @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(locations={"classpath:applicationContext.xml"}) public class BaseDALTest extends AbstractJUnit4SpringContextTests { public BaseDALTest() { super(); } @Resource protected SessionFactory sessionFactory; } applicationContext.xml: <?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.xsd"> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName"> <value>org.hsqldb.jdbcDriver</value> </property> <property name="url"> <value>jdbc:hsqldb:mem:sample</value> </property> <property name="username"> <value>sa</value> </property> <property name="password"> <value></value> </property> </bean> <bean id="sessionFactory" class="com.foo.spring.AutoAnnotationSessionFactoryBean"> <property name="dataSource" ref="dataSource" /> <property name="entityPackages"> <list> <value>com.sample.model</value> </list> </property> <property name="schemaUpdate"> <value>true</value> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect </prop> <prop key="hibernate.show_sql">true</prop> </props> </property> </bean> </beans>

    Read the article

  • onCommand on button not firing inside gridView??

    - by sah302
    This is really driving me crazy. I've got a button inside a gridview to remove that item from the gridview (its datasource is a list). I've got the list being saved to session anytime a change is being made to it, and on page_load check if that session variable is empty, if not, then set that list to bind to the gridview. Code Behind: Public accomplishmentTypeDao As New AccomplishmentTypeDao() Public accomplishmentDao As New AccomplishmentDao() Public userDao As New UserDao() Public facultyDictionary As New Dictionary(Of Guid, String) Public facultyList As New List(Of User) Public associatedFaculty As New List(Of User) Public facultyId As New Guid Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 'If Not Session("associatedFaculty") Is Nothing Then' ' Dim associatedFacultyArray As User() = DirectCast(Session("associatedFaculty"), User())' ' associatedFaculty = associatedFacultyArray.ToList()' 'End If' Page.Title = "Add a New Faculty Accomplishment" ddlAccomplishmentType.DataSource = accomplishmentTypeDao.getEntireTable() ddlAccomplishmentType.DataTextField = "Name" ddlAccomplishmentType.DataValueField = "Id" ddlAccomplishmentType.DataBind() facultyList = userDao.getListOfUsersByUserGroupName("Faculty") For Each faculty As User In facultyList facultyDictionary.Add(faculty.Id, faculty.LastName & ", " & faculty.FirstName) Next If Not Page.IsPostBack Then ddlFacultyList.DataSource = facultyDictionary ddlFacultyList.DataTextField = "Value" ddlFacultyList.DataValueField = "Key" ddlFacultyList.DataBind() End If gvAssociatedUsers.DataSource = associatedFaculty gvAssociatedUsers.DataBind() End Sub Protected Sub deleteUser(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) facultyId = New Guid(e.CommandArgument.ToString()) associatedFaculty.Remove(associatedFaculty.Find(Function(user) user.Id = facultyId)) Session("associatedFaculty") = associatedFaculty.ToArray() gvAssociatedUsers.DataBind() upAssociatedFaculty.Update() End Sub Protected Sub btnAddUser_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAddUser.Click facultyId = New Guid(ddlFacultyList.SelectedValue) associatedFaculty.Add(facultyList.Find(Function(user) user.Id = facultyId)) Session.Add("associatedFaculty", associatedFaculty.ToArray()) gvAssociatedUsers.DataBind() upAssociatedFaculty.Update() End Sub Protected Sub Delete(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs) End Sub End Class Markup: <asp:UpdatePanel ID="upAssociatedFaculty" runat="server" UpdateMode="Conditional"> <ContentTemplate> <p><b>Created By:</b> <asp:Label ID="lblCreatedBy" runat="server"></asp:Label></p> <p><b>Accomplishment Type: </b><asp:DropDownList ID="ddlAccomplishmentType" runat="server"></asp:DropDownList></p> <p><b>Accomplishment Applies To: </b><asp:DropDownList ID="ddlFacultyList" runat="server"></asp:DropDownList> &nbsp;<asp:Button ID="btnAddUser" runat="server" Text="Add Faculty" OnClientClick="incrementCounter();" /></p> <p> <asp:GridView ID="gvAssociatedUsers" runat="server" AutoGenerateColumns="false" GridLines="None" ShowHeader="false"> <Columns> <asp:BoundField DataField="Id" HeaderText="Id" Visible="False" /> <asp:TemplateField ShowHeader="False"> <ItemTemplate> <span style="margin-left: 15px;"> <p><%#Eval("LastName")%>, <%#Eval("FirstName")%> <asp:Button ID="btnUnassignUser" runat="server" CausesValidation="false" CommandArgument='<%# Eval("Id") %>' CommandName="Delete" OnCommand="deleteUser" Text='Remove' /></p> </span> </ItemTemplate> </asp:TemplateField> </Columns> <EmptyDataTemplate> <em>There are currently no faculty associated with this accomplishment.</em> </EmptyDataTemplate> </asp:GridView> </p> </ContentTemplate> </asp:UpdatePanel> Now here is the crazy part I am simply boggled by, if I uncomment the If Not Session... block of page_load, then deleteUser will never fire when btnUnassignUser is clicked. If I keep it commented out...it fires no problem, but then of course my list can never have more than one item since I am not loading the saved list from session into the gridview but just a fresh one. But the button click is being registered, because page_load is being stepped through again when I am viewing in debug mode, just deleteUser never fires. Why is this happening?? And how can I fix it??

    Read the article

< Previous Page | 12 13 14 15 16 17 18 19 20 21 22 23  | Next Page >