How to redirect after gridview row updating?

Hello Experts,

I use the following on a button to redirect the user to the same page when it's clicked:

protected void btn_refresh_emp_name_ddl_Click(object sender, EventArgs e)

Open in new window

I would like to do the same thing when a gridview row is updated, so I tried this:

protected void tbl_emp_gv_RowUpdating(object sender, GridViewUpdateEventArgs e)

Open in new window

but it didn't work.  

Any help would be greatly appreciated.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lokesh B RDeveloperCommented:

why do you want to redirect to same page after updating?

after updating what do you want to do?

If you want to Update Your Grid, Please call GridView1.DataBind();

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Kaushal AroraTechnical AnalystCommented:
Dear ferguson,

The solution provided by Lokesh is correct if you want to show the updated data only after updating.

If you still want to redirect, kindly do it in the RowUpdated Event and use the below code for that.

Response.Redirect(Request.RawUrl, false);

Open in new window

False is added so that the code written after Response.Redirect should not get executed.

Hope this helps you.

Kaushal Arora
ferguson_jeraldAuthor Commented:
Thanks!  That's what I needed.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.