Add Record to Static row at Bottom of UltraGrid - c#

I am a newb to Infragistics and have the following problem:
I have three UltraGrids on the form, one for each of three tables.
I want a fixed row at the bottom of a each band(for the table it references) so that one could add a new record into this row, like one could do with in MS-Access.
I finally got a "static/fix" row at the bottom of the Grid, but
i can for the love of me figure out how to edit it.
I HAVE DONE EXTENSIVE SEARCHING and even asked the Infragistics
experts over at http://blogs.infragistics.com/forums.... but to no Avail..
When at runtime i select this grey row, the Foreign-key(MainAction's ID field) appears but i cannot enter information into the other fields
To summarize:
I want to be able to edit the grey row at the bottom of each ban and when/if i press enter, it should add it to the database.
Kind Regards
Markus

You should activate the row setting the
grid.DisplayLayout.Override.CellClickActivation = Activation.Edit
or Activation.EditAndSelectText

Related

How to remove DataGridView last row ButtonColumn Button c#?

I am doing a windows application in c#.
Can any one help me to solve this issue. I have use datagridview in my form which is contain ButtonColumn and 3 other columns. generates the form with total values of the columns in last row. problem is I want to remove the Button Column Button in Last row (Grand Total row).
In here I have use local database table as a data source for the DataGridView. Please help me.
This is the output
You may try to reach for that cell after data is loaded and make it "less button". Following code comes from the top of my head and hasn't been tested, but it is just worth trying.
int DetailColumnIndex = 0; //or whatever it is
var LastButtonCell =(DataGridViewButtonCell)myDataGridView.Rows[myDataGridView.Rows.Count-1]
.Cells[DetailColumnIndex];
LastButtonCell.Value = null;
LastButtonCell.FlatStyle = FlatStyle.Flat;
Then make sure that when it is clicked, the eventhandler detects that it is the last button and does nothing

Change column view DataGridView

The title may be a bit confusing, and I'll try my best in trying to explain my problem.
I have a horizontally scrollable datagridview and when I click a button on the menu bar, I want the datagridview to move the view to the specified column, while still having all columns still visible.
So For example I click on Fish, and then the datagridview should scroll/position itself to the first mention of Fish in the columns to show a section of the view all related to Fish, while still maintaining all other columns not related to Fish and viewable.
What I would like to know is, is the moving of the position of the view possible to do? I didn't know what to search up, and more or less the results of the search included re-ordering of the columns, which I do not want.
For a DataGridView with windows form --- give your cell to Particuler Id.
Like you want to assign a one column with Fish then
row.Cells["Name"].Value = Fish.Id;
and then on click event give focus to this id.
Note:- for a better solution post your question with your code.
thanks
Replace fish to your search text and try it.
List<DataGridViewColumn> Cols = dataGridView1.Columns.Cast<DataGridViewColumn>().Where(c => c.HeaderText.Contains("fish")).ToList();
if (Cols.Count > 0)
{
dataGridView1.FirstDisplayedScrollingColumnIndex = Cols[0].Index;
}
Above code will scroll down datagridview horizontally to show searched text in column names.

ASPX GridView edit clicked cell only

I am binding data in a DataTable to a GridView.
The result is a simple table with 5 columns and 3 rows.
What I want to achieve is:
If an user clicks on a cell in the GridView, the selected cell should become editable (with a textbox). In that textbox the user should have to possibility to enter new value and save it to the database.
What I've achieved so far is:
I followed this tutorial: http://www.dotnetlogix.com/Article/aspnet/80/How-to-make-GridView-Individual-Cells-Selectable.html
I managed to make the cells clickable, when clicking the cell the background color becomes red:
With that tutorial I also managed to get the ColumnIndex and RowIndex.
So I was able to do: GridView.SetEditRow(RowIndex);
Then my result became:
This is almost what I want, but not 100%. The SetEditRow edits the whole row, but I need to edit the clicked cell which is based on a row and column index.
Can anyone help me further please?
I've followed some other tutorials as well, but without result.
I tried this a few years ago and ran into a few issues, I don't recall all of them off the top of my head right now. What I ended up doing was using a repeater instead of a gridview to build a table. Since I'm writing the HTML I have more control over things. The table contained both a dig tag for the static value and a text input for the edit value. I used jquery to show and hide when needed. I then used ajax to post the changes back. This was a lot of work, but it ended up working out ok. Hope this helps.

How do I position a DataGridView to a specific row (so that the selected row is at the bottom)?

As a question similar to this question, I also have an application with a DataGridView on it. I would like to position the rows such that a specific row is at the bottom of the visible part of the list.
This is in response to a button click that moves a row down by one. I want to maintain the selection on the row I'm moving (I already have this part working). If there are lots of rows, the selected row might move below the visible area. I want to scroll down until it's at the bottom of the visible area.
There does not appear to be a LastDisplayedScrollingRowIndex companion to FirstDisplayedScrollingRowIndex.
Any ideas? Thanks.
As my own guess, I think I need to use FirstDisplayedScrollingRowIndex and the number of rows visible in the DataGridView to calculate the new FirstDisplayedScrollingRowIndex. Maybe I just need to find out what the NumberOfVisibleRows property is called?
Found it. DisplayedRowCount:
if (dataGridView.FirstDisplayedScrollingRowIndex + dataGridView.DisplayedRowCount(false) <= selectedRowIndex)
{
dataGridView.FirstDisplayedScrollingRowIndex =
selectedRowIndex - dataGridView.DisplayedRowCount(false) + 1;
}
Code tested and working in my own project.
The DisplayedRowCount method will tell you how many rows are displayed on screen. Set the parameter value to true to include partial rows.
var displayedRows = myDataGridView.DisplayedRowCount(false);

Cleanest way to implement collapsable entries in a table generated via asp:Repeater?

Before anyone suggests scrapping the table tags altogether, I'm just modifying this part of a very large system, so it really wouldn't be wise for me to revise the table structure (the app is filled with similar tables).
This is a webapp in C# .NET - data comes in from a webservice and is displayed onscreen in a table. The table's rows are generated with asp:Repeaters, so that the rows alternate colers nicely. The table previously held one item of data per row. Now, essentially, the table has sub-headers... The first row is the date, the second row shows a line of data, and all the next rows are data rows until data of a new date comes in, in which case there will be another sub-header row.
At first I thought I could cheat a little and do this pretty easily to keep the current repeater structure- I just need to feed some cells the empty string so that no data appears in them. Now, however, we're considering one of those +/- collapsers next to each date, so that they can collapse all the data. My mind immediately went to hiding rows when a button is pressed... but I don't know how to hide rows from the code behind unless the row has a unique id, and I'm not sure if you can do that with repeaters.
I hope I've expressed the problem well. I'm sure I'll find a way TBH but I just saw this site on slashdot and thought I'd give it a whirl :)
When you build the row in the databinding event, you can add in a unique identifier using say the id of the data field or something else that you use to make it unique.
Then you could use a client side method to expand collapse if you want to fill it with data in the beginning, toggling the style.display setting in Javascript for the table row element.
just wrap the contents of the item template in an asp:Panel, then you have you have a unique id. Then throw in some jquery for some spice ;)
edit: just noticed that you are using a table. put the id on the row. then toggle it.

Categories

Resources