Click here to Skip to main content
14,090,690 members
Rate this:
 
Please Sign up or sign in to vote.
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
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

   
v2
Comments
Anuja Pawar Indore 2-Mar-12 7:58am
   
Added link tag
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 3

<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.
   
v3
Comments
Anuja Pawar Indore 2-Mar-12 8:00am
   
Removed text from code block
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

<asp:TemplateField HeaderText="No.">
                                    <ItemTemplate>
                                        <asp:HyperLink ID="lbtnBOLNo" runat="server" Text='<%# Eval("No") %>' OnClick="lbtnBOLNo_Click"></asp:HyperLink>
                                    </ItemTemplate>
                                </asp:TemplateField>


protected void lbtnBOLNo_Click(object sender, EventArgs e)
    {
        templbtn = (LinkButton)sender;
        ScriptManager.RegisterStartupScript(Page, this.GetType(), "alert", "window.location='Default2.aspx'; ", true);
    }
   
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190518.1 | Last Updated 2 Mar 2012
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100