Enable/Disable HyperLinkField

  • Thread starter Thread starter pargat.singh
  • Start date Start date
P

pargat.singh

I am using <asp:HyperLinkField in gridview as below which is working
fine.

<asp:HyperLinkField HeaderText="Process"
Target="_blank" DataTextFormatString="Process me"
DataTextField="doc_name" DataNavigateUrlFields="doc_name"
DataNavigateUrlFormatString ="~/aaaa.aspx?path={0}" />

Currently it is displaying "Process Me" for all row and opening new
window.But i have some records which are already processed and for
those record i want to display Processed and i don't want to open the
new window.

Can anyone please show me how can i do that?

Thanks in advance.

Pargat
 
Hello.

On the item databound event of the grid, you will need to see if the item
has been processed, if it has you would do

e.Item.FindControl("[HyperLinkField id"]").Text = "processed";
e.Item.FindControl("[HyperLinkField id"]").Enabled = False;

Hope that Helps,

Jon
 
Back
Top