Skip to content Skip to sidebar Skip to footer

Avoid Page Refresh When Clicking On Linkbutton In Gridview

I have a GridView control, and inside of this control I have defined a link button using GridView.ItemTemplate. I am using this to open a new window on click. When I click on the l

Solution 1:

I would not use a LinkButton, but a straight html link.

<ContentTemplate><ahref="#"ID='<%#Eval("product code")%>'onclick="doSomething();">
        <%#Eval("productcode")%>
    </a></ContentTemplate>

And then you can define some javascript in the page.

functiondoSomething(ProductCode) {
    // enter the code here to open the window
}

Also, I would stay away from using UpdatePanel, but that's just my preference.

Post a Comment for "Avoid Page Refresh When Clicking On Linkbutton In Gridview"