Click here to Skip to main content
15,898,968 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionhiding label and textbox after update Pin
spirospap22-Jul-15 19:16
spirospap22-Jul-15 19:16 
Hi all,

I have a question regarding hiding of a label and a textbox on a page based on AD group membership (I only want members of the AD group to view and use the ASP control)

So I have the following within my Page_Load Sub
Dim ITContactLabel As Label = DirectCast(FormView1.FindControl("ITContactLabel"), Label)
Dim ITContactTextBox As TextBox = DirectCast(FormView1.FindControl("PRJ_ITContactTextBox"), TextBox)

If (User.IsInRole("MyDomain\My_AD_Group_X") <> "true") Then
    '   hide the ITContact label
    ITContactLabel.Style("visibility") = "hidden"
    ITContactTextBox.Visible = "false"
End If

And it works fine when the page is first loaded, but after I hit the update link, the label and textbox become visible.

I have tried to define an OnClick event in my code, but not having success hiding the label and textbox:

Protected Sub UpdateButton_Click(sender As Object, e As System.EventArgs)

in html:
<asp:linkbutton id="UpdateButton" runat="server" causesvalidation="True" onclick="UpdateButton_Click" commandname="Update" text="Update">

I'm thinking it may have something to do with checking the AD group membership, but not sure, any help would be appreciated.
AnswerRe: hiding label and textbox after update Pin
Blikkies23-Jul-15 0:46
professionalBlikkies23-Jul-15 0:46 
GeneralRe: hiding label and textbox after update Pin
spirospap23-Jul-15 12:11
spirospap23-Jul-15 12:11 
SuggestionRe: hiding label and textbox after update Pin
ZurdoDev23-Jul-15 3:26
professionalZurdoDev23-Jul-15 3:26 
QuestionTrying to prevent the first dropdownlist value changing my database field unless I need to in C# Pin
Norris Chappell22-Jul-15 16:30
Norris Chappell22-Jul-15 16:30 
AnswerRe: Trying to prevent the first dropdownlist value changing my database field unless I need to in C# Pin
Herman<T>.Instance23-Jul-15 11:06
Herman<T>.Instance23-Jul-15 11:06 
GeneralRe: Trying to prevent the first dropdownlist value changing my database field unless I need to in C# Pin
Norris Chappell23-Jul-15 18:23
Norris Chappell23-Jul-15 18:23 
GeneralRe: Trying to prevent the first dropdownlist value changing my database field unless I need to in C# Pin
Herman<T>.Instance23-Jul-15 20:51
Herman<T>.Instance23-Jul-15 20:51 
Questionquery Pin
saif.rashid21-Jul-15 22:35
saif.rashid21-Jul-15 22:35 
AnswerRe: query Pin
Blikkies21-Jul-15 23:13
professionalBlikkies21-Jul-15 23:13 
AnswerRe: query Pin
F-ES Sitecore22-Jul-15 0:40
professionalF-ES Sitecore22-Jul-15 0:40 
AnswerRe: query Pin
Richard Deeming22-Jul-15 1:42
mveRichard Deeming22-Jul-15 1:42 
GeneralRe: query Pin
Herman<T>.Instance22-Jul-15 22:42
Herman<T>.Instance22-Jul-15 22:42 
QuestionDevExpress ASpx Gridview Row Selection on keyboard Arrow key Pin
hemant kolekar20-Jul-15 19:33
hemant kolekar20-Jul-15 19:33 
AnswerRe: DevExpress ASpx Gridview Row Selection on keyboard Arrow key Pin
Wendelius20-Jul-15 19:43
mentorWendelius20-Jul-15 19:43 
QuestionCSRF question Pin
Stephen Holdorf20-Jul-15 10:31
Stephen Holdorf20-Jul-15 10:31 
AnswerRe: CSRF question Pin
Anil Vaghasiya20-Jul-15 19:37
professionalAnil Vaghasiya20-Jul-15 19:37 
AnswerRe: CSRF question Pin
Richard Deeming21-Jul-15 1:37
mveRichard Deeming21-Jul-15 1:37 
QuestionSchedule for update date in C# Pin
Member 1173518720-Jul-15 3:19
Member 1173518720-Jul-15 3:19 
AnswerRe: Schedule for update date in C# Pin
Richard Deeming20-Jul-15 7:22
mveRichard Deeming20-Jul-15 7:22 
QuestionDeployed website Error Pin
Stephen Holdorf17-Jul-15 7:54
Stephen Holdorf17-Jul-15 7:54 
AnswerRe: Deployed website Error Pin
Stephen Holdorf17-Jul-15 8:09
Stephen Holdorf17-Jul-15 8:09 
GeneralRe: Deployed website Error Pin
Stephen Holdorf20-Jul-15 10:07
Stephen Holdorf20-Jul-15 10:07 
Questiondid't got solution Pin
Rahul Singh Baghel16-Jul-15 21:46
professionalRahul Singh Baghel16-Jul-15 21:46 
AnswerRe: did't got solution Pin
User 418025417-Jul-15 2:58
User 418025417-Jul-15 2:58 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.