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

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

Related

Write selected GridView data to a TextBox on another Webpage C#

I have a Gridview on a webpage which is populated with data fed from a XML file, the gridview also contains a checkbox column. I have another page which has a textbox placed on it. I require to send the selected rows from the gridview to the textbox on the other page by the click of a button.
The screenshot above is the gridview of the items being fed from an xml file. I require the checked rows of the gridview to be displayed in a textbox, which is displayed on another page of the web application, and this is to be done by clicking the 'Send Items' button. Could anyone help me with this?

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

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...

Textarea in gridview showing old values before saving and binding

I have a GridView which consists of Textbox in each row and its textmode property is set to 'Multiline'.
Whenever I edit the Textbox and click Save button, the edited Textbox in gridview shows the old values for a second, gets saved in database and binds the new value.
The GridView is enclosed in an UpdatePanel and also its ViewState property is set to false.
Binding is done only after saving the records.
I don't know where it is going wrong.
I have a feeling it has something to do with when your databinding.
Try setting the viewstate back to true, then databind your gridview on
1) !Page.IsPostback
2) After you have finished the save operation

asp.net gridview editing

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()

Categories

Resources