Click here to Skip to main content
15,908,909 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi,

In my website page i have a gridview with links for 2 columns. When i click on image or any other link in grid column it is posting the page.

How to place gridview in an updatepanel and how to bind gridview image control Ids to update pannel asynchronous trigger.

Please help me..

Thanks.
Posted
Comments
vijay__p 2-Apr-13 5:30am    
What you are doing by clicking on Image/ImageButton (Updatating something)?

Hi,

you can place your gridview inside update panel as below.
ASP.NET
<asp:scriptmanager id="ScriptManager1" runat="server" />
<asp:updatepanel id="UpdPanel1" runat="server" childrenastriggers="true" >
    <contenttemplate>
        <asp:gridview id="GridView1" runat="server" onrowdatabound="GridView1_RowDataBound" autogeneratecolumns="false">
            <columns>
                ''''
            </columns>
        </asp:gridview>
    </contenttemplate>
</asp:updatepanel>

you can specify the gridview link button (Any Button for that matter) as post back trigger as below.

specify RowDataBound Event for gridview and inside that event function write below code.
C#
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)  
{  
    LinkButton lb = e.Row.FindControl("LinkButton1") as LinkButton;  //Link button ID
    ScriptManager.GetCurrent(this).RegisterAsyncPostBackControl(lb);  
} 

You need to register each and every LinkButton as an AsyncPostBackTrigger. After each row is bound in your GridView, you'll need to search for the LinkButton and register it through code as above. You can specify any button inside the gridview as post back trigger as above.

hope it helps
 
Share this answer
 
v3
Hi,

if you want update panel in function of an other control. you can see this

http://www.asp.net/web-forms/tutorials/aspnet-ajax/understanding-asp-net-ajax-updatepanel-triggers

good luck

jerem
 
Share this answer
 

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