Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
395
TemplateField with either HyperLink or Label
posted

Hello,

i have a WebDataGrid and one of this columns should contain either a HyperLink or a Label depending on the type of item. So, if it is a "Folder" then a HyperLink should be shown and the user should drill-down to the next level in folder hierarchy. In case of a "File" i would only have a Label.

I converted the boundfield into a template view. But at design time i could only add both controls.

Has anyone a sample how to do this?

Thank you

Martin

Parents
  • 37874
    posted

    Hello Stumpy74,

     

    I would suggest that you handle the InitializeRow event and depending on your condition hide or show the Label or HyperLink. You can access template controls using the following syntax:

     

    ((Label)e.Row.Items[1].FindControl("Label1")).Visible = false;

     

    Please let me know if you have any further questions.

Reply Children