hirdesh ronaldo

hirdesh ronaldo

  • NA
  • 4
  • 13.5k

Prevent page refresh on linkbutton click in gridview

Feb 4 2014 2:22 AM
Hi All,
I need help, I have one gridview and inside the gridview I have link buton which I create using Itemtemplate in gridview.
I am opening new popup window on linkbutton click in gridview. It works fine I am able to open popup  window on linkbutton click.
the prob is when i click on link button whole page is refreshing before opening the popup.
I want to stop that page refresh. Please help me.. my code is given below
 
code for link button in gridview
<ItemTemplate>                                                          
                                                             
<asp:LinkButton ID="lnkviewtools"   runat="server"  OnClick="lnkviewtools_Click" Text='<%#Eval("varToolName") %>'></asp:LinkButton>
                                                   
                                                            
</ItemTemplate>
 
code for on click
protected void lnkviewtools_Click(object sender, EventArgs e)
    {
       
            LinkButton Lnk = (LinkButton)sender;
            Session["toolname"] = Lnk.Text; 
           
            ClientScript.RegisterStartupScript(this.GetType(), "", "<script> window.showModalDialog('ViewToolProcurement.aspx', 'dialogHeight:100px;dialogWidth:280px;status:no'); </script>");
          
      
      
    }  

Answers (3)