Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi every one.

I used my userControl inside Gridview template.
One of my UC features, is that i can delete that row from usercontrol.
Is there any way that when i delete row, Databind()-Refresh gridview, From UC code behind ?

Thanks in advance.
Posted
Comments
On delete event, can't you do this?

One trick is that you can out your gridview inside a UPDATE PANEL. and from your user control you can update the Gridview. Hope this help you.

--SG
 
Share this answer
 
Comments
arminamini 2-Oct-13 7:31am    
Thanks for ur answer.
with what command i can update gridview, from my usercontrol?
Hey there,

Here is what you can do:

Create a public method to bind the GridView on the page where the GridView resides, let say method name is BindGrid, and your page name is Test1, So in UserControl CodeBehind you can do this:

C#
Test1 myPage = (Test1)this.Page;
            if (myPage != null)
            {
                myPage.BindGrid();
            }


Hope it helps.

Azee...
 
Share this answer
 
You can refresh your gridview by again binding the data to gridview.
 
Share this answer
 
Comments
arminamini 2-Oct-13 6:24am    
How can i do it from UserControl, after deleting? Coz i dont have access to GridView from my UC!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900