asp.net - Check if hyperlink in gridview has been clicked c# -


hi know how text field , index hyperlink in gridview has been clicked. basically, user click on hyperlink in gridview , when user has been navigated link, text field , index of link stored arraylist. have idea how can go doing this?

i have came "pseudo code" onrowdatabound event handler in gridview:

arraylist linksclicked = new arraylist();  if (e.row.rowtype == datacontrolrowtype.datarow)         {             hyperlink hl = (hyperlink)e.row.findcontrol("links");             if (hl != null)             {                 linksclicked.add(h1.tostring());             }         } 

you should use itemtemplate linkbutton. in button can keep index or id commandargument, catch event onclick , add index array. use sample.

<asp:templatefield>         <itemtemplate>            <asp:linkbutton id="hyperlinkbutton" text="link" postbackurl="youruri.com" runat="server"             commandargument="<%# eval("somefieldyouneedarguementfrom") %>" onclick="hyperlinkbutton_click" >            </asp:linkbutton>         </itemtemplate>     </asp:templatefield>   protected void hyperlinkbutton_click(object sender, eventargs e) {     linkbutton btn = (linkbutton)(sender);     string yourvalue = btn.commandargument;     // need here }   

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -