how to delete a row in a gridview using delete button outside the grid? - c#-2.0

i have a grid in which there are various records. On my form i have a Update and Delete button outside the grid. there are different textbox. when i selected a row in a grid its value appear in these textbox from where i can update these value. thats work fine for me. Now i want to delete the selected row?
i dont want to delete a record using delete button in the grid. i want when i select a row and press a delete button then the selected row should delete from grid as well from database.

I guess if you have already done the update part then you can easily delete the selected row. Just call a delete function, instead of the update one, and then call the DataBind() function of the GridView.

Related

Is there a way to get a cell value from the selected row in DBGrid? (Delphi)

First of all, I'm pretty new to Delphi.
I have a DBGrid connected to a DataSource and filled up with data from an SQL server. What I want to achieve is that when I press a button, it brings up a new window with comboboxes/editboxes, all filled up with the previously selected (in DBGrid) row's data and modify them and execute an UPDATE query.
In order to do that, I need the primary key value of the selected record, so my little program would know which row should it display and update.
My question is, how can I get a specific cell value (in this case, an id) of a selected record from a DBGrid?
If you know the column for the ID field you can inspect its Field property. The Fields Value will contain the current ID.

What event to call when ListView selected item changed?

I'd like to run a procedure--once--whenever the selected item in a ListView changes. The obvious choice would be OnSelectItem, but it's called twice when the user moves from one selected item to another (using mouse or arrow keys). Similarly, OnChange is called three times when moving between items.
Is there an event generated only once under these conditions? OnClick is generated once, but doesn't cover moving between items using arrow keys, etc.
You can do it like this using OnSelectItem.
Remember the last selected item.
When the OnSelectItem fires, check if the current selected item differs from the one you remembered.
If so, perform your task, and make a note of the new selected item.

jquery mobile table - detect change in select

My table contains a column that contains a "select".
I need to detect when the user changes the "select" value of the cell so I can make DOM changes to other cells in the row.
I have no idea how to detect that event.
Figured it out.
Added an onchange to the html <td>.
Thanks;

How to select just one row, prevent to unselect item in singleselect mode

My question is very simple but I really didn't find any solution here.
I have a Table setSelectable(true), setMultiselect(false), setImmediate(true).
It works fine by first click and moving through the table using arrows.
But if I click again to the row already having been selected,
then it becomes unselected. How to prevent it?
I'd like to have kept just one row always selected.
As from the Vaadin Book here:
If the user clicks on an already selected item, the selection will deselected and the table property will have null value. You can disable this behaviour by setting setNullSelectionAllowed(false) for the table.
So:
table.setNullSelectionAllowed(false);

Delphi DBGrid disable clicking on another row when editing

I have a dbgrid displaying data from a Ttable and my problem is that when
editing a row in the grid the focus is on the row that I want to edit but I can
still click on another row and edit it. How do I disable clicking on another row
or keep focus on the same row?
Second question is (still on the dbgrid) when I edit a column and double click on that column,
the focus moves to the end of the text line therefor not showing the original text but only showing maybe the last character and spaces.
Please help...
After a while of playing around with this, I've discovered that there's no easy way
to disable the user from moving from the highlighted row (row to edit) when clicking another row.
The best way is to cancel when he clicks on another row, I'm using a TTable and TQuery, so
on the BeforePost event, just do a cancel on your table or query. But you also need to do the
same on the AfterScroll even, just in case.
Thanks for all your help.

Resources