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
I found this post and tried e.Row.Items(0).FindControl("linkNbr_of_Claims_Sent").Visible = False, but all I seem to get is an error that says "System.NullReferenceException: Object reference not set to an instance of an object."
Any suggestions?
Hi Martin,
I'm glad you solved your issue. If you have any other questions, please do not hesitate to ask.
Dear Nikolay,
that is the solution. It works fine.
Thanks
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.