asp.net gridview editing - c#

I have a gridview (Edit and Delete enabled) that shows a table. A Text Box and A Button. When I type something in the textbox and click the button, the button runs the datasource.filterexpression and filters out the rows.
The question whenever I click on the edit button after the filter has been applied The grid auto resets back to the original table? How can I solve this?

After saving the edited record in the GridView RowUpdating event, re-apply the filter and call DataBind()

Related

textindex change firing multiple time with 2 gridview in update panel asp.net c#

I have two gridview in one update panel one gridview1 working with selected index change and another gridview2 for entry details based gridview1 selection. gridview2 having dropdown and textbox it works both on mouse pointer and tab saving to db through textindexchanged event if end user press tab it works fine else if after typing in textbox they directly cilck to griview then textindex change firing twice in asp.net c# web application

Save a editable Grid View on a single save button ASP.NET 2.0

I have an editable gridview. The rows are editable. I can save each row by clicking corresponding save button for each row.
But the problem is I can not have save button/Link for each row. there will be a single "save" button below the grid. After changing values on the grid , by clicking on save all the changed rows will be updated in DB.
Have a look at this tutorial: GridView Bulk Editing

Asp.net Keydown Event not always fired within GridView

Within a griview (using IE), cells in one column are clickable (through gridview row command event) and once a cell is clicked it displays a hidden textbox (visible = false before the cell is clicked); users can enter text into the textbox and to allow saving changes made to the textbox users are told to press Tab key.
The saving is done through using Javascript by checking keycode in keydown event, it simply checks when keycode = 9 (Tab key) __doPostback('OnClick','SaveButton'); in codebehind SaveButton onclick event simply calls a store procedure to save the new text changes into database.
The problem I have is keydown event is not ALWAYS fired though it works most of the time. There seems to be no difference to the situation when it works and when it doesn't, so to me it's a bit random and I have to emphaise that it works 90% of the time.
Worth mentioning that when users click the cell to edit the textbox, gridview row updating event is fired first since I need to enable gridview row updating event not only for this column text changes but also for other columns data updating.
When everything 'works' after user pressing the Tab key, the event sequence is:
Gridview row updating
Keydown/SaveButton click
Gridview row updating
I don't understand what triggers the event 3 i.e. the second gridview row updating event though it doesn't do any harm to anything as it's after the text being saved into database. But when pressing Tab key doesn't work (text not saved) the second gridview row updating event is not fired; only the 1st row updating event is fired and textbox changes are lost reverting back to the original text.
I'm new to asp.net and hope someone can shred some light on this problem.
I found out why GridView row updating event fired for the 2nd time, it's because AutoPost for the editable textbox being set to True.
silly me...

how to stop validation control when a cell of gridview become clicked

i have a gridview and some text boxes with required field validator and buttons all inside of a table and table is inside of update panel.
I am displying data in textboxes on the click of a specific record of gridview and all was working fine but after applying some validation to text boxeses(e.g., required fied validator) as i click to the gridview validation get runs and the gridview record is not showing to me becuase of validation.
so how can i show data??
ongridview selected index change event
txtfirsName.Text= gvData.SelectedRow.cells[1].Text;
and i think above code not a problem but i have posted .real concern with validation

Disable and highlight a row in gridview when delete command field delete button is clicked

I want to Highlight and disable a gridview row on delete button click. I am using a data table and binding it to the grid and changing the flag IS_DELETED='Y' when user clicks delete button . The Delete button is currently in command field. As soon as the user clicks on the delete button it should disable the row and hide the buttons so that it restricts the user from further edits. Can some please help me in resolving this issue. This has been troubling me since long. Thanks is advance.
See this fiddle as a basic sample using jQuery. Google about jQuery in you need. Again - you need to handle button click and then change it's parent row.
$('input.delete').click(function(){
$(this).closest('tr').find('input.button').hide().end().addClass('disabled');
});

Categories

Resources