Web Forms :: Filtering Data In A Nested Master Form Based On User.isinrole?
Dec 8, 2010
My website has a "charts" menu item that lets you choose from about a dozen pages each with a different chart in them. Each one of these pages uses the same nested master page which has some drop-down lists and text boxes to let the visitor do some filtering of what data shows up in the charts (I do this by building SQL statement parts in the nested master page and triggering an event that the chart page reacts to).
Anyway, One of the DropDownList controls shows the names of everyone in the Company (I use MembershipProvider and RoleProvider). What I want to is have the DropDownList show a different collection depending on the role that the visitor is in; If the visitor is in the "Principal" role, I want them to see everyone. If they are not in that role, I want them to get only their own name.
I expect I'd have to do this in code-behind... But thought I'd check to see if anyone knows if it is possible to have an "IF" statement in the SQL DataSource for this control that can refer to the role that the current logged-in user belongs to
View 1 Replies
Similar Messages:
Dec 8, 2010
basically I am try to replicate a filtered list like this;
[URL]
but I need it to work on an asp.net, and rather than having to hit a button to load an xml data file I need the data to be initialised when the page loads and get the data from a SQL Server database.
is there a standard .net control I can use?
View 1 Replies
Dec 9, 2010
I have a tricky requirement where I need to categorise documents attached to a product, available for download, based on the status of the user viewing the product. I.e. my site displays a list of products, clicking on one displays a product details page, and this page includes a list a documents related to the product, such as data sheets, user manuals, etc.
I have been asked to group documents into three classes of availability, v.i.z. those available freely to all users, including anonymous; those available to logged on users; and those available to anonymous users that provide contact information before downloading the document, presumably to boost sales leads.
The anonymous and logged on availabilities are quite easy, but the third seems a bit tricky to me. My first question is, is there a way I can filter documents for only logged on users without hooking into ItemDataBound or something, and my second question is, what is recommended for the case where a user must supply contact information to download a document?
In the second question, it has crossed my mind to actually register the user, but without them having to visit the new user registration page, and then I have role based filtering of documents. Currently the new user registration process automatically adds the Member role to all new users. Users I register 'quietly', just so they can download a document, wont be assigned the Member role, distinguishing them from normally logged on members.
View 1 Replies
Sep 10, 2010
I've got a web site that has a master page and that master page (mpMaster that has a user control ucControl1) which has a sub user control (ucControl2), this user control has a property which accepts a value. Now, I have a page that uses the master page
and on this page I have another user control (ucPageControl), I need to find a way of setting the value in ucControl2 from ucPageControl. Is this possible at all?
View 5 Replies
Dec 23, 2010
Following is the structure of the pages in application
[Code]....
Suppose the user is on ..../paycheck.aspx which is the content page. But when ...../paycheck.aspx loads, "lnkDynamic" properties "Text and PostBackUrl" must be set. Which events should be handled .....
View 3 Replies
Feb 17, 2010
I'm using Forms authentication and I would like to make use of roles, can I somehow set the role of the user without Membership ?
View 4 Replies
Mar 13, 2010
How would one go about filtering rows based on a certain criteria on a Gridview?
View 3 Replies
Jan 25, 2011
I'm securing an ASP.NET MVC 2 application, and I have a user who is in the role "Foo".
This is true:
User.IsInRole("Foo")
But yet, when I attempt to lock down a controller action like the following, the user is denied:
[Authorize(Roles = "Foo")]
public ActionResult PrivatePage()
{
return View();
}
If IsInRole reports true, why would the Authorize attribute not allow the user in?
View 2 Replies
Mar 15, 2010
My ASP.NET app is using windows authentication. If I run the following code:
WindowsIdentity wi = (WindowsIdentity)User.Identity;
foreach (IdentityReference r in wi.Groups)
{
ListBox1.Items.Add(r.Translate (typeof (NTAccount)).Value);
}
if (User.IsInRole ("Everyone"))
Label1.Text = "Is in role";
The listbox will contain the name of every group the user belongs to. If I then call User.IsInRole, and pass in the name of any of those groups, I always get a false.
View 2 Replies
Apr 11, 2010
I have a form that contains a number of user controls (partial views, as in System.Web.Mvc.ViewUserControl), each with their own view models, and some of those user controls have nested user controls within them. I intended to reuse these user controls so I built up the form using a hierarchy in this way and pass the form a parent view model that contains all the user controls' view models within it.For example:
Parent Page (with form and ParentViewModel)
-->ChildControl1 (uses ViewModel1 which is passed from ParentViewModel.ViewModel1 property)
-->ChildControl2 (uses ViewModel2 which is passed from ParentViewModel.ViewModel2 property)
-->ChildControl3 (uses ViewModel3 which is passed from ViewModel2.ViewModel3 property)
My question is how do I retrieve the view data when the form is submitted? It seems the view data cannot bind to the ParentViewModel:public string Save(ParentViewModel viewData)...
as viewData.ViewModel1 and viewData.ViewModel2 are always null. Is there a way I can perform a custom binding?
Ultimately I need the form to be able to cope with a dynamic number of user controls and perform an asynchronous submission without postback. I'll cross those bridges when I come to them but I mention it now so any answer won't preclude this functionality.
View 1 Replies
Oct 18, 2010
I have a Gridview on my aspx page that is filtered based on a series of fields. One of these fields is a drop down list 'Status' the options are; 'Read', 'Unread' and 'Both'.
The SQL Stored Procedure expects serveral parameters including a bit parameter for the field 'Read'. If the Drop Down list has Read or Unread in it my Stored Parameter works but if it has Both in I am not sure what to pass to the Stored Procedure to get it to give me all records or basically ignore the Read field.
View 3 Replies
Feb 13, 2010
how can I find out if one of the user is the member of any role? For the logged user, I use User.IsInRole("Admin"), but how to find out if the nonlogged user is in the role?
View 2 Replies
Mar 16, 2010
I am writting a directory website that advertises fitness classes. These classes are listed by Class Type, and Geographical Area. Each Class Type can satisfy one or more of four Fitness Goals such as Loose Weight etc...
I have a table for Classes (classid, classname, classdesc, classtypeid, geoareaid) I have a table for geographic areas (geoareaid, geoarea) And I have a table for ClassTypes (classtypeid, classtypename, classtypedesc)
Which obviously links geographic area via the classes.geoareaid as a forgien key and classtypes by classes.classtypeid as a forgien key.
I can list all classes by type and also by geo area no problem, the problem arrises when I then also want to filter by goal.
The Goals Table (goalid, goal, goaldesc) is linked to the classtypes table via another table classtypes_goals (classtypeid, goalid) as each classtype can satisfy any of the 4 goals.
I am using a DataSet to fetch the data from a Stored Procedure in the SQL Database but because the classtypes can be linked to multiple goals I am getting duplication in my list depending on how many goals a classtype satisfies.
All I need in my data list is class name, class type and area I don't even need to display the goal I just want a drop down above the table that will filter the list and show only classes of classtype that satisfy the goal chosen.
View 18 Replies
Aug 4, 2010
I got a Master page and nested master pages in the subfolders.
Top Level Master page
Second Level Master page inherited Top Level Master page
Third Level Master page inherited Second Level Master page
However, changes (i.e. new images & alt. name) that I made in the Top level master page did not apply to the second or third levels.My webpage has a correct front page but not in the sections. How can i correct this ?
View 3 Replies
Mar 14, 2010
I have a standard gridview, with the standard paging and sorting interface enabled.The application holds appointments for three organisational units, with a maximum of 3000 appointment records being returned across all three units. The appointment records are quite small.
The choice I am faced with is to:
1. Have an Org Unit dropdown which returns to the datasource on change of selection and at inital databind, and returns appointment records for one org unit at a time i.e. approx 1000 records.
2. Have the objectdatasource return all 3000 appointment records for all org units at initial databind, and filter the objectdatasource by org unit on change of selection, thereby saving a trip to the datasource.
I guess the question boils down to identifying the point at which querying the datasource by org unit is more efficient than filtering the records returned by org unit.
Is 3000 records a lot for a gridview to be paging and sorting etc.
View 3 Replies
Jun 23, 2010
For the solution, I cannot use any event handling methods, because my webapp is fully ajax based and no complete postback is possible. So here's the problem.I have a `List<WebPage>` that contains a list of Links `(List<Link>)` and I need for all the links to bind repetitive information such as page title, id, url. Here is my current repeater.
<div id="result">
<asp:Repeater runat="server" id="results">
<Itemtemplate> [code]....
View 1 Replies
May 29, 2010
I was looking tutorial for Master/Detail and I have one question. If I populate DropDowList with some data from database and run application, DropDownList show the first record from database. And if I choose some Item from DropDownList DataList show result of filtering. How when I run application to populate DataList as Detail using parametar of first Item in DropDownList populated from database?
View 5 Replies
Dec 10, 2010
I need to bind a List control based on the Gridview Row's datakeyName value while the Gridview control is being loaded into the page. I tried the following but it does not work.The BulletedList control is nested inside a Gridview Control and they both bound to an ObjectDataSource control. In my code, I passed teh UserID into the UserID parameter and call the Select() method but still does not work. Basically, I want to list of a user's hobbies, therefore the hobbies control are driven by the userID. tell me how can I get it to work?
protected void UserGridView_RowDataBound(object sender, GridViewRowEventArgs e)
{
int UserID;
[code]...
View 1 Replies
Jun 26, 2010
i am working in asp.net and csharp, we have 10 user, but certain user only need to put dataentry. how to enable and disable based on the user to access certain form ,like add, modify view options.
View 1 Replies
Dec 1, 2010
On page load is there a way to enumerate all the nest user controls for that specific page load?
I'd like to be able to enumerate all the user controls that implement an interface, and call the interface method for the controls before asp.net passes control to thier page_load events.
The problem is from the master page level, any page in the app could be loading, and each of them could have any random user control, and I need the type reference to determine if they implement the interface, and to call the method.
View 1 Replies
Mar 6, 2011
I have added a jquery datepicker on my MVC view. This view has a partial view. I need to filter my partial view based on the datepicker's selected date. I need to show buttons on partial view based on the date.
I have added partial view like this:
div id="dvGames" class="cornerdate1"> % Html.RenderPartial("Partial3"); %>
/div>
View 5 Replies
Sep 10, 2010
I would like to ask if it is possible to access data on a master FormView from a nested detail FormView.
I have a main form (master) with several tabs (detail) and would like to display a label with text from main form that is hidden by the tab at the moment of editting. My asp page looks like this.
[Code]....
Is it possible to get the value of the label CompanyTextLabel from CompanyTextBox using just ASP.NET expressions or something similar without writing c# code in .cs file?
View 4 Replies
Jul 3, 2010
I have created a gridview (this is a usercontrol) with another gridview (also a usercontrol) inside it. Now I would like to bind a checkboxlist to the inner gridview. This is my markup for the inner gridview user control
<asp:GridView AutoGenerateColumns="False" GridLines ="None" Width ="100%"
View 5 Replies
Nov 9, 2010
I have a Transport Detaisl in DB , i want to dispay data on gridview with marquee scrolling up. Cabs are scheduled for drop every hour. So if drop is at 7pm i hav to dispaly on data of that hour from 6:30 to 7:15 later after 7:15 i have to display next hour data ie 8:00 pm drop data. I am able to get scrollin g data on gridview but how to schedlue it to scroll for such timings
View 1 Replies
Aug 26, 2010
I have a gridview, based on thsi datasource:
[Code]....
Using a dropdownlist, I can filter (by changing datasource) the results based on customer names in a dropdownlist. This datasource, working perfectly, looks like this:
[Code]....
Now, using a textbox and a ajax calendar, I would like to be able to filter on the date as well, but my datasource so far:
[Code]....
doesn't work very good. In some case sit doesnt show anything, in onther situations - with 10 records for a given date, it only shows one.
Question one: How do I make the last datasource work? Its probably - again-again - something with the datetime formats, but for the life of me, I can't see how to do.
Question two: The Ideal solution would be using the first datasource, SqlDataSourceAllLoads, and then be able to filter the results with filterexpressions/parameters, but again, how? The filterparameters would origin from a DropDownListKunder, matching the tblDeliveredInfo.deliveryInfo_FirmaNavn as seen in the second datasource, while the date comes from the textbox txtStartDate (databinding fired by a button).
View 3 Replies