How To Hide A Object To Some Particular Users Without Using Code
Feb 6, 2010
i need to hide an object(any control)on .aspx page for a perticulat user,
For Example::
I have two controls one is a lable control and another one is a button control on my Default.aspx page, and there are two users A and B, Lables control can be visible for A and B. But Button control is only visible for A but not to B. to do this i dont have to use any C# or VB code.
The calendar extender is designed to automatically hide when the user clicks out side of it. [URL]. However, in the markup below that isn't happening. The click outside is ignored forcing the user to select a date to make it hide. [Code]....
<?xml version="1.0"?> <!-- Note: As an alternative to hand editing this file you can use the web admin tool to configure settings for your application. Use the Website->Asp.Net Configuration option in Visual Studio. A full list of settings and comments can be found in machine.config.comments usually located in WindowsMicrosoft.NetFrameworkv2.xConfig
New users can register on my site by completing a basic form that has the create user wizard control with some additional information i am collecting using a CheckBox List. They can then log in to the site and and view "MypProfilePage.aspx" where I display the information with the CheckBoxList boxes already ticked based their selections which they can update. My problem is I have two levels of User and each one has a different registration form.
Registration Form A Has 20 Items in the CheckBox List
Registration Form B Has 10 items in the CheckBox List
On the Profile Page, I just want to show the CheckBox which is relevant to the Registration form A or B and with selections by the registered user. So therefore the User who registered on B will not be able to see the selections checkbox list for A.
In the behind code, I tried to access the button control in the listview. However, the code keep looping non-stop..
The logic is the Delete button will only be visible by the current logged-in user. And I had already set the button as visible = false. I had set breakpoint to the line : Delete.Visible = true;. Once the execution reach here, it loop back to the first line again..
And Delete button remain invisble despite the execute visible = true statement..
I am using the ajax reorderlist control from the latest Ajax Control toolkit. Based on the logged on user, I need to hide the "edit" and "delete" links. They should be visible to admin, and not visible to others. I used to control this when I was using a gridview just by calling the column and setting it's visible property to false. I have tried using:
""Object reference not set to an instance of an object."" Protected Sub CreateUserWizard1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.Load Dim SQLData As New System.Data.SqlClient.SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|ASPNETDB.MDF;Integrated Security=True;User Instance=True") Dim cmdSelect As New System.Data.SqlClient.SqlCommand("SELECT TOP 1 EmployeeId FROM a1_admins Order by Id DESC", SQLData) Dim label11 As Label = CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("Label11") SQLData.Open() Dim dtrReader As System.Data.SqlClient.SqlDataReader = cmdSelect.ExecuteReader() If dtrReader.HasRows Then While dtrReader.Read() label11.Text = dtrReader("EmployeeId") End While End If dtrReader.Close() SQLData.Close() End Sub End Class
I'm getting the object refernce not set to an instance of an object error in the code below.I couldnt figure it out, where I'm going wrong.VB.NET Syntax (Toggle Plain Text)
I am creating a function to hide all the gridview controls except the control whose name is being passed in the function.
Here this.Controls referes to controls present in the page (At compilation error is thrown although). I want to fetch all the controls of type GridView with Name property not equal to the one passed in the funtion.
Now after getting a collection of GridView. I want to hide all the grids
private void HideGridView(string gridToShow) { GridView[] result = from control in this.Controls where control.GetType() == typeof(GridView) && control.Name !=gridToShow select control as GridView; foreach (var control in result) control.Visible = false; }
At comile time it shows me this.Control as invalid because it is not a collection.
How can I achieve this on a web application
EDIT:
private void HideGridView(string gridToShow) { (from control in this.Controls.OfType<GridView> where control.Name !=gridToShow select control).ToList().ForEach(gv=>gv.Visible=false); }
Here is the code I wrote, shows me an error: GridView is a type but used like a variable (Compile time error). And at where Invalid Expression Term 'where'
Everything works fine on my dev machine which is running Windows 7. However, when I deploy my app to my production server at MaximumASP running 64 bit Windows 2008 R2 Standard, I just can't access those pages that are handled by my URL Routing logic. I'm getting the infamous "Object reference not set to an instance of an object." error.
The code below is my URL handler for Mailbox module in my application. I've defined mail folders in my database. All this does is if user is looking for /mailbox/Inbox, it looks up the folderID and sends the user the mailbox.aspx page which is expecting a folderID
What I want is to show menu items Administrator or show user menu items.Show menu items using login...How I can do it with role provider, control menu and siteMap in masterpage?
I have the following scenario. An user uses the desktop application to call our WCF Service which has windows authentication. The WCF Service calls the Office Communication Server (OCS) in order to do some custom work.
When the WCF Service calls OCS we have to pass an instance of NetWorkCredential into the call. I want to pass in the original calling users NetworkCredential object into the OCS call rather than constructing it using a custom username and password. How do I get access to the calling users NetworkCredential object from the WCF service and pass it to the OCS call?
I am looking for a solution to a Java Script question. My question is this, I have a gridview, and in this gridview I have a column, which I use as a flag. The gridview itself is dynamically added to a user control and then to the page. What I would like to do is to use Java Script to hide this column, but I do not know how to do this. Unfortunately, I cannot use code behind, because of the gridview being dynamically added. Also, I have one further question, I already have some Java Script code that can hide some of the rows based upon the values in my column when a button is clicked. What I want to do is when the page is loaded for the first time, to hide some of these rows, and to use the button in reverse to reveal them again. How do I achieve this?
I have a column within my gridview that displays status of the records. Certain records we need to prompt for additonal information and confirmation so we are using a modalpopup, but other records dont need the popup, so how can i disable or prevent the modalpopup from opening for those records?
Here is my template column for that field:
[Code]....
within my onclick="hypHT_Click" event im doing a simple modalpopup.Show(); how can i check the gridview in order to determine if i need to show it or just disable it.
I have asp.net page that having the wizard control. I wanted to make visible false Next Button when other than Admin logged in (say dealer,subdealer log in). How to make it invisible or to change its text . I tried this line to make it in visible :
I don't want to show Create word in query string . What i have to do. And how to implement the Post/Redirect/Get pattern .Please send me code for this if possible.
In a button click, I need to be able to hide my ModalPanel and then continue running other code server-side. I currently have it this way:
[Code]....
It hides the panel at the of the event handler because that's when the page posts back. So what can I do to hide the panel and then continue running the rest of the server-side code?
Basically what I'm trying to do is the following:
1. Button_display in my webform simply displays my UpdatePanel via ModalPopupExtender.
2. Button_closePanel_Click will hide my UpdatePanel and then run some server-side code, which would display my UpdateProgress control.
I have a custom control. Some properties throw a custom error message when no value is supplied. The message shows up fine, but also does the code. For example ...