.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

access control from masterpage

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
How do I get access to the below linkButton control from my Master page or a page using that Master, this is in my Master page:<Project:RoleControl ID="RoleControl1" runat="server"> <AdminTemplate> <li id="liadmin" runat="server"><asp:LinkButton id="lnkAdmin" PostBackUrl="~/admin/admin.aspx" runat="server" CausesValidation="false">Admin</asp:LinkButton></li> </AdminTemplate> </ Project:RoleControl> Basically it's a custom control I built which will allow me to show certain things only to admin users, we are not using asp.net membership so I came up with a control that works. But when I try to access it within the Master page itself it keeps saying the control has 0 count in it, I'm doing this check in the Page_Load event:if (RoleControl1.Controls.Count > 0) { string roleControlId = RoleControl1.Controls[0].ID; ((HtmlGenericControl)RoleControl1.FindControl(roleControlId)).Attributes["class"] = "navselected"; } But the RoleControl1.Controls.Count check is always 0. I know the control is rendering as I can see it when the page loads, the link comes up. I thought maybe I'm checking it in the incorrect event, rather than Page_Load should I be checking for it in another event, could it be that at that point

View Complete Post

More Related Resource Links

unable to access control inside webuser control



I have used calender web user control inside my project where i took textbox,button and calender.....but after dragging onto my aspx page....i am unable to access this textbox,calender and button on aspx page...Pls help me to find out the solution.

Access Control: Understanding Windows File And Registry Permissions


Understanding the ACLs that govern permissions and rights before an operation is allowed to proceed is critical to enhancing security.

John R. Michener

MSDN Magazine November 2008

Security Briefs: Access Control List Editing in .NET


Access control lists (ACLs) can be complex beasts, and user interfaces for editing them are incredibly tricky to implement properly. That's why I was really excited when Windows® 2000 shipped with a programmable ACL editor, shown in Figure 1.

Keith Brown

MSDN Magazine March 2005

Provisioning: Use Web Services Provisioning to Control Access, Usage, and Billing on Your Site


Building Web Services to provide enterprise-level solutions is only the first step. You need to take care of the infrastructure aspects of your solution as well, including provisioning, billing, security, and reporting. In this article, the author uses the .NET Framework and SQL Server 2000 to design a provisioning system that will take care of all these housekeeping tasks. He discusses the general requirements of a Web Service provisioning system, walks through the implementation, and then outlines various scenarios for putting this system to work.

Chandu Thota

MSDN Magazine December 2002

Access and Bind data wihtout using Datasource Control


i want to bind my gridview with a dataset with concept of caching (to minimize the database server trips). plz give me a best example to get and bind data to gridview (command line) . grid paging is also enabled so example code should be capable to rebind data at Gridview page change.  

Access Public Function in MasterPage

Hi,I need help in accessing the function in my masterpage.I have a.master and b.aspx with the content page.Now in the page load of my content page, I want to execute the an sql query which is in a function in my master page.How can I access the function in my master page??code in my master page:public function info () as string'SQL Queryend function

How to Access Parent Page (.aspx) control (IDs) from its child User Control (.ascx)

I have a parent .aspx page that has a asp:panel control in it, and this parent .aspx is also referencing a user control that I registered in that .aspx. Lets just call it usercontrolA.ascx for this post.The user control has a radiobuttonlist itself.Based on a selection from the radiotbuttonlist in the user control, I want to be able to hide the asp:panel in my .aspx (parent) but unfortunately I cant' get it to work:parentPanel.visible = true;  <<< I trried this in usercontrolA.ascx.csBut the user control doesn't know about the panel in the parent .aspxSo do I need to expose that somehow from the parent so that I can access it from the code behind of the child .ascx?  How?

Can't access a control in a listview layout template with codebehind

While running ItemDetabound upon load of a listivew, I am trying to access the text in a label of the LayoutTemplate of a different Listview.  It works fine if I try access the same labels under the same names if they are in the same listview, but not if they are in a different one.  It was working for a while, can't figure out what I changed, but now says that object doesn't exist.   Here is the html code for the labels: <LayoutTemplate> <table ID="Table2" runat="server" cellpadding="0" cellspacing="0"> <tr ID="Tr1" runat="server" style="padding-left: 0px"> <th ID="Th1" runat="server" style="text-align: left; white-space:nowrap; "> <asp:Label ID="Label1" runat="server">Label 1</asp:Label> </th> <th ID="Th2" runat="server" style="white-space:nowrap; width: 150px" >

Access UserControl Control from a JavaScript Function

I have a requirement to launch a Modal Javascript dialog box from within my usercontrol,I have done this by <code> function browseControlAction(ProjID,ControlID) { strPrompt = 'Select a Previous control action..'; strOptions = 'dialogWidth:25;dialogHeight:30;status:no;resizable:yes'; selectedAction = window.showModalDialog('browseControlActions.aspx?ProjID=' + ProjID + '&Control=' + ControlID, strPrompt, strOptions); var sControl = ' + ControlID + '; if (selectedAction != null) { alert(ControlID.toString()); alert(selectedAction); var sTest = ControlID + '_txtControlAction'; alert(sTest); var sTest2 = 'txtSummary'; alert(sTest2); document.getElementById('txtCurrentControls').innerText=selectedAction;   //this works as this a control on the page itself document.getElementById(sTest2).innerText=selectedAction;      //Ditto document.getElementById(sTest).innerText=selectedAction;    //This Fails as this is the control in the USercontrol I am trying to Access //__doPostBack('',''); }</code>can anybody tell me why I can't access the Textbox control on the USercontrol?

How to access ServerSide control Value in Javascript changed by Ajax

Hello,I have a Textbox whose value is been changed using ServerSide code (AJAX based - Partial postback) and now I want to access that changed value in JavaScript. Please suggest me that how can I access that value.document.getElementByID is displaying old value.Things work fine with full postback but are creating above issue with Partial Postback.Thanks, in Advance....

Control User Access to Document Workspace

I have set up a document workspace section with several folders and files.  I have set up a group that has full control and set up a group with contribute.  Now I would like to set up several groups that will only have access to specific portions within the site for contribute.  I see where I can set up group overall, but have not seen where to narrow down to spefici folders/files for group to view.  Do I get to the specific folder or document and then set up access or do it from Home?   Any help is appreciated! Peter

Cannot access public methods on MasterPage

Hi All, maybe someone can help me with this one. I have a a public method in my code behind on the site.master pagenamespace PROJECT { public partial class Site : System.Web.UI.MasterPage { protected void Page_Load(object sender, EventArgs e) { } public void applyUserRole(string userID) { } } } I  wish to call applyUserRole() from Default.aspx On Default.aspx I have .. <%@ Page Language="C#" MasterPageFile="Site.Master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" Title="Project- Home" %> <%@ MasterType virtualPath="~/Site.master" %> But when I go to Default.aspx.cs and type Master. the method is not appearing. I've seen other post where people are having this issue but I can't find an answer. If anyone has any good pointer and you please let me know, thanks 

Accordion control access in Javascript using Content page

Hi, I struggled with some javascript issues, and discovered that the problem seemes to come from a failed ajax control access.Here's my problem:I have a master page and a content page.In my content page, I have an accordion with 2 panes.1rst pane: a textbox and a validation button;                     I want the button to fire javascript function without reloading page (using "return false;");In my master page, I put my ToolkitScriptManager.In my content page, I put my script containing the functions.The problem is that it seems like I can't access the accordion control in my js functions, whereas I can access my textbox value...Here is my source:<%@ Page Language="C#" MasterPageFile="~/Default.master" Title="CLEOR RH | Home" CodeFile="Default.aspx.cs" Inherits="Default_aspx" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %> <asp:Content ID="Content1" ContentPlaceHolderID="Main" runat="server"> <script type="text/javascript"> var step1 = false; function pageLoad() { var accCtrl = $find('AccordionCtrl_AccordionExtender');

Access Control List tables in sql server 2005

Hi all, Can anybody help me in creating Acl tables.how to create them in sqlserver 2005 and how to use in my .net application

Access Control List tables in sql server 2005

Hi all, Can anybody help me in creating Acl tables.how to create them in sqlserver 2005 and how to use in my .net application

SSIS Execute Process Task Give "Access is Denied" error but it is not related to access control.

Hello All - I have a very weired SSIS problem. I am using BIDS in two machines - Windows 7 Professional Edition x64 bit (development workstation) and Windows 2003 Standard Edition x32 bit SP2 (server) . The visual studio version on both the machines are Version 2.0.50727 SP2. I found that my package's ExecuteProcessTask fails with "Access is denied" error in Windows2003 but runs ok in Windows 7 dev box. I then tried to debug the package in the Windows 2003 environment itself. The package failed in debug mode too with the same message. After looking for a while I found that when I shorten the Argument length of the failing ExecuteProcessTask the task did seem to work. So in Windows2003 environment if my argument exceeds 1846 characters the ExecuteProcessTask fails with message "Access is Denied". If the argument string is less than 1846 it works ok. In Windows 7 environment there is no problem at all. It does not seem like access problem but I may be wrong. Has anyone seen this? I will appreciate any reply. Thanks, Niben  

User Access Control

Hai, I am using VS2005 and SQL Server 2000 I have few small exe like duty_roster, Leave_mgt, Overtime etc. and Have a main exe named HRIS. Now I am calling these exe when run HRIS. there is a list of exe and when anyone click on the specific name then that exe open and he can work. Now I want to control on access. How can I create the dynamic access so that if I want anyone to give specific modules, menu, submenu, popmenu access then give it and later if i want i can off. I have little idea that there will be a user group with specific access. Now I create the usergroup but how can I set the access. Please help me how can I do this. It would better if u can give me link of same examples or code. please help me.please please
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend