Click here to Skip to main content
15,902,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want to write code on hyperlinkfield onclick event in gridview.
I have hyperlinkfield in grid view. plz tell me hoe to write code on that.
Posted

 
Share this answer
 
v2
Comments
Anuja Pawar Indore 2-Mar-12 7:58am    
Added link tag
C#
<asp:linkbutton id="lnb" runat="server" text="Edit" commandname="Edit" commandargumnet="<%Eval(" xmlns:asp="#unknown">


when u click on that link your Row Command Event will fire
do your functionality there.
 
Share this answer
 
v3
Comments
Anuja Pawar Indore 2-Mar-12 8:00am    
Removed text from code block
XML
<asp:TemplateField HeaderText="No.">
                                    <ItemTemplate>
                                        <asp:HyperLink ID="lbtnBOLNo" runat="server" Text='<%# Eval("No") %>' OnClick="lbtnBOLNo_Click"></asp:HyperLink>
                                    </ItemTemplate>
                                </asp:TemplateField>


C#
protected void lbtnBOLNo_Click(object sender, EventArgs e)
    {
        templbtn = (LinkButton)sender;
        ScriptManager.RegisterStartupScript(Page, this.GetType(), "alert", "window.location='Default2.aspx'; ", true);
    }
 
Share this answer
 
Comments
dcba1 2-Mar-12 7:49am    
function is not working..
dcba1 2-Mar-12 8:12am    
event is not firing..
Bojjaiah 2-Mar-12 8:16am    
now check it it's working fine

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