Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Or anyone else...

 

PlausiblyDamp let me know the wonders of the datalist control... much better than making dynamic tables... what I have is basically a page that is similiar to these... display items, and has buttons to edit or delete. The problem I'm having is that the edit and delete are only for administrators. How do I, via databinding, determine on a data list that because this guy isn't an administrator the buttons should not be visible... or I guess even loaded in this case? I'm learning a lot all at once and overwhelming myself... MSDE, ASP.NET, DataList control... if web form buttons have a visible property... could someone still back door it through 'View Source'... or does ASP.NET see that it isn't visible and doesn't even bother outputting it to HTML? Hope you follow... Thanks for the help...

 

Brian

Posted

You could so something like..

 

If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then

  If Not blnAdministrator Then
     CType(e.Item.FindControl("btnDelete"), LinkButton).Visible = False
  End If

End If

  • Administrators
Posted

Just a quick answer for now - you may want to investigate authentication within the .Net frame work. This will allow you to check if a user is in a particular role (group). The two main forms are Windows Authentication (useful if you have a windows domain) or Forms Authentication (if you need to create your own security model).

If you have a search on MSDN or http://www.gotdotnet.com you should find a fair few examples.

As to enabling or disabling these you may want to look at some of the events of the datalist - not sure which would be the most useful as my MSDN is playing up (doing a new install of VS at the moment).

Posting Guidelines FAQ Post Formatting

 

Intellectuals solve problems; geniuses prevent them.

-- Albert Einstein

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...