Need to dynamically add or remove the EditButton on a Editable DataList in VB.NET

J

jack

Hello,

I have a editable DataList, and would like the Edit Button to be appear or
not appear dynamically based on the access the logged in person has.

I have tried to use the visible=false, with no luck.

Any help would be great an example in VB.NET would be the most helpful.

Thanks in advance for your time and help,

Jack
 
R

Rick Spiewak

You can accomplish this in the itemcreated event of the DataList. Use a
template, so you can give your controls a recognizable ID. Here is an
example of how to find a particular control:

Dim itm As DataListItem = e.Item
Select Case itm.ItemType

Case ListItemType.EditItem
tb = DirectCast(itm.FindControl("txtStartDate"), TextBox)

Then, you can set the .visible property as needed.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top