How do I make an ASP.Net GridView postback on an onBlur event?

On your TextBox set AutoPostBack="True" . This will cause a postback when the client change event fires, which is probably what you want rather than blur . Attach a TextChanged handler to the textbox and you can call your grid update method from there.

Up vote 0 down vote favorite share g+ share fb share tw.

I have an ASP. Net GridView, with two columns ("ID" and "name"). The name column is editable via an .

What I want to do is have the grid trigger its update event when the user clicks away from an editable cell. I know I can attach an onBlur event handler to the TextBox to retrieve the value when the user clicks away. However, I don't know how to trigger the GridView's update event programmatically through JavaScript.

Any suggestions? C# javascript asp.net link|improve this question asked Oct 29 '10 at 15:30quanticle7661511 100% accept rate.

I would vote for a simple webservice that can take a string and an ID as an argument and update the appropriate record. – R0MANARMY Oct 29 '10 at 15:45.

On your TextBox set AutoPostBack="True". This will cause a postback when the client change event fires, which is probably what you want rather than blur. Attach a TextChanged handler to the textbox and you can call your grid update method from there.

You can get the row index for the textbox that triggered the event like this: protected void TextBox2_TextChanged(object sender, EventArgs e) { GridViewRow gridRow = ((GridViewRow)((TextBox)sender). NamingContainer); Console. WriteLine(gridRow.

RowIndex); }.

That was exactly what I was looking for. I was initially worried that autopostback would post-back on every keystroke but MSDN assured me that this wasn't the case. – quanticle Nov 1 '10 at 15:54.

You could call the submit method for your Form object from the onBlur event. MyForm.submit().

You could set AutoPostback="True" on your Textbox and in the Codebehind save the new valuein the Event Handler.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions