I have created a Windows form using Visual C# - this contains a rich textbox. I have an Access database containing text in 2 cells (rows) of 1 column.
What I want to be able to do is:
Concatenate the contents of rows within my Access table
Display the concatenated rows in the rich textbox on my form
Be able to edit the contents of the rich textbox and save the changes back to the table
So far I have bound the table to the rich textbox, though only 1 cell (row) is being displayed - the data that I will be concatenating is text, each cell in the table won't have a unique value - each cell simply holds a section of a paragraph.
I have read the Update command & Retrieve command of ADO.Net, though it seems that data must have a specific value i.e. Select Name from People where value = Peter
Is there a chance of me achieving what I want to achieve here?
No.
Instead, I would store each value in a separate column in the database, and then bind each textbox to that field.
Related
I have a gridview as you can see here:
As you can see i read the data in materialrequestcontractorId i have a listbox that this listbox reads its value from the database as you can see here:
List<MaterialRequestContractor> lstMRC = _materialRequestContractorRepository.Get().ToList();
foreach (MaterialRequestContractor VARIABLE in lstMRC)
{
LstMaterialRequestContractorId.Items.Add(VARIABLE.Id);
}
But the problem is i need to show my user the name of my MaterialRequestContractor not its id ,the id should be the value of my name and be saved in database .but in devexpress i can't assign this value and text to list box?
I have a record in my MaterialRequestContractor database with id=1
DevExpress provides several lookup editors for WinForms (LookUpEdit, GridLookUpEdit, SearchLookUpEdit) which support such scenario out-of-the-box. The idea is that LookUp editor has its own data source. When it is shown in the grid, it finds a value with from the grid cell in its data source (the key column determined by the LookUpEdit.Properties.ValueMember property) and shows the value from a field that selected as DisplayMember.
So if you put a table that has MaterialRequestContractor and MaterialRequestContractorId fields, and properly select DisplayMember and ValueMember, the DevExpress grid should work just like you described.
I am trying to bind a numeric field in an oracle table to a Datagridview - combo list in windows forms. With this what am trying to achieve is;
1 ) Based on the numeric value present in the number field, fetch ad display the respective string value in dataviewgridcombolist column.
2). When a new row is added in the datagrid view, the user may be allowed to select a listed (string) value in the combo list and the respective index value to be stored in the table back.
lots of thanks in advance..
Regards
Rithesh Krishnan
I've created a customized grid control. Where you can specify each column type the respective editing control will be displayed - for the combo box column a combo box field will be displayed, for the numeric column a numeric editor will be displayed.
While user adding a new row also user will get these editors. Usage of this class as follows
customDataGrid1.ColumnDataTypeMapping.Add("EmployeeName", CustomDataGrid.CustomDataGridColumnType.TEXT);
customDataGrid1.ColumnDataTypeMapping.Add("ManagerID", CustomDataGrid.CustomDataGridColumnType.COMBOBOX);
customDataGrid1.ColumnDataTypeMapping.Add("JoinDate", CustomDataGrid.CustomDataGridColumnType.DATE);
customDataGrid1.ColumnDataTypeMapping.Add("DateOfBirth", CustomDataGrid.CustomDataGridColumnType.DATETIME);
customDataGrid1.ColumnDataTypeMapping.Add("Salary", CustomDataGrid.CustomDataGridColumnType.NUMERIC);
I've created 4 Data GridView Dynamically. The Data Source of each of the gridviews is a DataTable. It has 3 columns, first column type being string, second and third column being DateTime. The First Column has static data. On clicking the second and third column cells, I want a DateTimePicker to come allowing user to select DateTime Value.
You may need a template Row, see details here:
http://social.msdn.microsoft.com/Forums/br/netfxbcl/thread/2677158c-76a3-4e65-8ae4-18373a80516e
Try something like this - Make a new DataTable (that has the schema you need). Then add 2 or 3 controls (one for string input, and either CheckBox or 2 radioButtons that will determine which DateTime column will be filled). When user clicks on DateTimePicker, it will fill one column, then he can selects/deselects the CheckBox, and select the second date. When all values are properly set, user can click the Submit button that:
- Fills the DataTable with proper data.
- Changes the DataGridView's DataSource
This is just my idea on how you can solve this, there may be another way.
I think it might be possible to do changes doing DataBindings, but I choose not to look into it.
Instead of attaching DataTable as DataSource, I took e.g mentioned here MSDN customised it as per my needs and then created DataGridViewColumns and iterated over Rows of DataTable to fill up content. I did write any template code.
Q:
I wanna to ask about report design issue.
If my report data source is set of data tables in a data set. And in some cases the data table is empty, How to hide the table(I mean the control which use this empty datatable as a data source) to prevent spaces and empty data in my report ?. Is there some control like panel to make it invisible under the condition of( the source of specific table is empty)?
Please explanation,because I'm a beginner for the reports.and I'm confused about the design ,and formatting issues.I will be grateful if there are resources to help me in this area.
For Example:
How to hide both of the title and the table if the data table used as a data source to the table below is empty without leaving spaces between sections of my report.
thanks in advance.
Set the tablix/table visibility hidden property to = CountRows() = 0
The CountRows() for a dataset return's the number of rows the query returns.
When CountRows() returns 0 rows (no data) the condition return's TRUE
for the hidden property of tablix, so it hides the tablix control
To hide the title you have two options:
Use a list to contain both the table and the title textbox. If CountRows equals 0 hide the list (which contains the other two)
Add a row on top of the table column headers. Place the title there.
I am using C# winform's DataGridView control to display data present in a table to the user. All data gets present in the database table gets displayed to the user perfectly except the last column's data which contains data in XML format. In data DataGridView control the last column always gets displayed as empty but in fact in database the last column contains the xml formatted data. The GUI settings of the last column of the DataGridView control is shown below:
Can anyone suggest me how to display the xml formatted data in this DataGridView control?
There is no direct way. You'll have to fetch the XML attribute/node values through XPath using a stored proc.
You can start from here