C# - Hide Repeater Columns Based On User Privileges?

Feb 9, 2011

how to hide a repeater column based on the user privileges.

Say I have:

<asp:Repeater ID="repeater" runat="server>
<HeaderTemplate>
<table id="table_id">
<tr>
<th>Name</th>
<th>Secret Info</th>
<tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td><asp:Label ID="Label1" runat="server" Text='<%# Eval("Name") %>' /></td>
<td><asp:Label ID="Label1" runat="server" Text='<%# Eval("SecretInfo") %>' /></td>
<tr>
<ItemTemplate>
<AlternatingItemTemplate>
<tr>
<td><asp:Label ID="Label1" runat="server" Text='<%# Eval("Name") %>' /></td>
<td><asp:Label ID="Label1" runat="server" Text='<%# Eval("SecretInfo") %>' /></td>
<tr>
<AlternatingItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

How would I only display the 'Secret Info' column to logged on users?

View 3 Replies


Similar Messages:

Forms Data Controls :: In Page User Able To Select Gridview Columns And It Will Hide Remaining Columns

Mar 18, 2010

in asp.net page user able to select gridview Columns, and it will hide remaining columns and that selection done by check box with column list bellow is Image link , what exactly I am looking for [URL] it look bellow after selection of column done [URL]

View 1 Replies

Hide Element In ASP Based On Inside Repeater

Jan 5, 2010

I know how to use a simple If statement wrapped in the <%# tags to hide something, but I don't know how to do it in a repeater when I need to access Container.DataItem, as in I need the dataItem currently being 'repeated'

eg

if (CurrentValidationMessage.Link != "")
{
show a hyperlink
}
Markup:
<asp:Repeater ID="repValidationResults" runat="server">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<a href='<%# ((MttImportValidationMessage)Container.DataItem).EditLink %>'> Link to erroneous Milestone </a>
<%# ((MttImportValidationMessage)Container.DataItem).Message %>
<br />
</ItemTemplate>
</asp:Repeater>

View 2 Replies

Forms Data Controls :: How To Hide/show Columns Based On The Dropdownlist Value

Jul 16, 2010

I have an emergency request that I need to sort it out very quickly as I did not notice it early :(.

I have a dropdownlist, the contnet in the gridview (sqldatasource connection) changes based on the value the user slects, say I have play1, play2 from the dropdownlist, I would like to show column1, column2 and column3 with user selects play1; show column4, column5, and clomn6 when use selects play2; the datatable actually includes all 6 columns.

I understand that I need to use something like RowCreated event, and I need to set up condition based on the dropdownlist value, but I dont really know how to.

View 3 Replies

Data Controls :: Hide Label In GridView / Repeater Based On Value

May 7, 2015

I have a nested repeater, I want to hide label control in child repeater if its empty.

View 1 Replies

Data Controls :: Hide Column In Repeater Based On Some Condition

Sep 14, 2013

My Repeater will display the data like below

Id  Name Mark1 Mark2 Mark3

1     aaa      50     30      20
2    bbb      50     30      30
3     ccc      50     30      20

if mark3 has all fields with 0 means i want to hide column mark3... How to do this....

View 1 Replies

Data Controls :: Display And Hide Specific Columns Of DataGridView Based On Condition

Jan 29, 2013

I have a table dt_details which includes columns -  name, address, phone,emailid, website,remarks,paid.

In the datagrid i have to display full columns only if paid is yes and if paid is no only name & phoneno should display.How to do that ?

View 1 Replies

Forms Data Controls :: How To Hide Empty Columns In A Repeater - Write The Logic For Hiding And Showing The Placeholder

Oct 20, 2010

I have a repeater control having columns in it.When I bind the control to a data source then some of the columns become empty when there is no data associated with it.I want to hide the column if there is no data associated with it.I was trying to implement a solution given in this thread:

[URL]

However,I am not sure how to write the logic for hiding and showing the placeholder.I have written some code for the same but that clearly doesn't work.The following is the .aspx as well as the code behind which I am using:

[Code]....

View 2 Replies

User Controls :: Show Hide Specific Section Of Page Based On User Type Or Role

May 7, 2015

I have LOGIN PANEL for student, and I want to disable it in different page. And only the admin can enable and disable it. I dont know the logic behind here.

View 1 Replies

SQL Server :: Creating Login/user With Correct Privileges?

Jul 27, 2010

From a stored proc, I need to restore a database from a backup (.bak) to a staging database, and then perform read operations on the staging database. The .bak is received from a business partner on a regular basis. The process must be fully automated via the stored proc (the process will be run overnight every 24-48 hrs).

View 1 Replies

Hide ActionLinks Based On User Roles?

Jul 8, 2010

In a standard, generated list view, how can I hide certain ActionLinks based on the roles the logged in user belongs to?

View 1 Replies

C# - Show Or Hide A Button Based On User Action?

Mar 14, 2011

Well I have a web page asp.net(page1.aspx) amm user can choose two options A/B if user chooses a when he is in page2.aspx i want a javascript was execute

function(receive parameter)
{
}

But if he chose option B function never will be executed. I want to do, if user chooses A will see a asp button, but if he choose option b he is not going to be the button

View 2 Replies

C# - Match SQL Columns Based On User Input?

Jan 24, 2011

What i am trying to achieve is that there are 7 columns in my db table. one is primary key and rest 6 are integer columns. Now my application will allow user to input 6 values. I want to compare 6 values entered by user to those 6 integer columns and if in any row 3 or more columns match user's input Primary key of that table is returned..

I have tried using queries, cursor, nested loops and i am still unable to achieve my results..

DB Table Structure.. I am inputting 2,3,7,11,45,65. Number of returned rows should be 5. eg..

UID A1 A2 A3 A4 A5 A6
-----------------------
1 2 3 4 5 6 7
2 2 3 4 55 56 57
3 65 11 45 66 67 68
4 45 7 11 99 98 97
5 7 7 7 7 7 7
6 7 7 7 7 7 7
7 8 8 8 8 8 8
8 8 8 8 8 8 8
9 45 45 0 3 1 2
10 65 7 4 0 0 0

IDs returned should be 1,3,4,9,10

View 6 Replies

MVC 2 Technique To Hide A Part Of A View Based On User Permissions?

Aug 30, 2010

What's the best technique to hide part of a view depending of the credentials of the user?

To explain my self little better and as example i have the following code in my view:

<%= this.Model.Name %> <%=Html.ActionLink("Edit",....)%>

And i would like to hide the edit button for those that aren't administrators for instance...

Could you give me a hand?

View 2 Replies

DataSource Controls :: Search Various Database Columns Based On User's Input?

Nov 18, 2010

I have five textboxes(tb1, tb2, ... tb5) on the page, each textbox represent a column in the database table.

I need to search the database table based on the text in the textboxes. User can either enter text in all five textboxes or none.

What's the best way to do a search?

I am thinking for one textbox(tb1), depends on if tb1.text is empty or not, I need to do 2 searches

[Code]....

for two textboxes(tb1 & tb2), depends on if tb1.text and/or tb2.text are empty or not, there are 4 combinations, so I need to do 4 searches

[Code]....

for three textboxes, there are 8 combinations,

Does that mean for five textboxes, I need to do 2 to the power of 5, 32 combinations, 32 if statements?

View 1 Replies

Filtering Repeater Items Based On User Status / Role?

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

Web Forms :: Xml Data Source Based Bounded Treeview - Hide Some Nodes Depend On User Session?

Jan 6, 2010

I am binding a treeview with XmlDataSource. On my login page I want to hide some node like

see my login code

if (Session["uname"] != null)
{
if ((Session["uname"]).ToString() != "")
{
if ((Session["UserType"]).ToString() == "Administrator")
{ dont hide nodes }
else { hide some nodes}
}
else
{
Response.Redirect("index.aspx");
Session["uname"] = "";
}
}
else
{
Response.Redirect("index.aspx");
Session["uname"] = "";
}
}

so how to do that, if you need my .aspx code for treeview so free to ask.

View 2 Replies

Hide Columns In GridView With Auto - Generated Columns?

Jan 19, 2010

GridView1.Columns.Count is always zero even SqlDataSource1.DataBind();

But Grid is ok I can do

for (int i = 0; i < GridView1.HeaderRow.Cells.Count;i++)

I rename request headers here but

GridView1.Columns[i].Visible = false;

I can't use it because of GridView1.Columns.Count is 0. So how can I hide them ?

View 5 Replies

Forms Data Controls :: Show / Hide A Div In A Nested Repeater By Clicking On A Button Inside Parent Repeater?

Nov 12, 2010

what changed do I need to make to my code for it to achieve what I'm after.

At the moment I am getting a "cannot cast to type" error message with the below code.

I have also tried calling the ItemDataBound method in with the parent repeater tags and had no errors but when I clicked on the button it would just move back to the top of the page and would not hide or show any data. Also I have made the div style to none but the first record still shows its child but the rest don't.

[code].....

View 1 Replies

How To Show / Hide A Panel Within A Repeater From A Button In The Repeater Itself

Apr 7, 2010

I have set up an asp repeater to go through and display a list of people based on input parameters. Within that repeater I have a repeater that displays specific details about each person. No problem so far.

However, my requirement is that I only display the names, with a plus/minus sign to the left of the name. Clicking on the plus sign will expand that person's information to show the details. Clicking the minus sign will collapse the detail info.

I have a panel set up within my primary repeater that encompasses the secondary repeater.

Here's the beginning of the code:

[Code]....

View 10 Replies

C# - Repeater Within Repeater (ajax Based Web App) - Cannot Use Any Postback Methods

Jun 23, 2010

For the solution, I cannot use any postback methods, because this is all working through ajax. The solution need to be implemented in the asp.net code. 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>
<asp:Repeater runat="server" datasource='<%# Eval("Links") %>'>
<Itemtemplate>
<tr class="gradeX odd">
<td><%# Eval("Id") %></td> //property of WebPage (part of results repeater)
<td><%# Eval("Title") %></td> //property of WebPage (part of results repeater)
<td><%# Eval("Url") %></td> //property of WebPage (part of results repeater)
<td><%# Eval("URL") %></td>//Property of Link
<td><%# Eval("URLType") %></td> //Property of Link
<td><%# Eval("URLState") %></td> //Property of Link
</tr>
</Itemtemplate>
</asp:Repeater>
</Itemtemplate>
</asp:Repeater>
</div>

of course this doesnt work, how can i do this?

View 2 Replies

DetailsView - How To Hide Columns

Jan 7, 2011

Suppose I have a DetailsView, which is bound to a SQLDataSource. The underlying table has two columns, an ID and a value. When in display mode, I want to display only the value. When I switch the DetailsView to edit mode, I want the user to edit the value, and not see or edit the ID. Making the ID column not visible solves this, EXCEPT that then the ID value is not stored in the DetailsView so two-way binding does not work, and I can't update the corresponding DB record. How do I do two-way data binding with a DetailsView, but hide the ID column from the user?

View 2 Replies

C# - Hide Columns By Id In Gridview?

Mar 17, 2011

I have the asp.net application where I am having the editable grid view with the edit,Delete,Add options. this grid having as usual Template fields . I want to hide some columns. I know i can do that by using columns index. but i don't want to follow it. instead I want to hide columns by Id. this is because if in my application further I need to add more columns then there is need to change the code gain and again in the core. so I am choosing this way. Bu as i found <asp:TemplateField /> does not contain Id attribute. so it is become impossible for me to hide <asp:TemplateField/> by Id.

View 3 Replies

Web Forms :: Cannot Hide Columns On GridView

Mar 25, 2011

I have a GridView that is successfully populated by an IList. IThere are about 2 dozen columns I only need 8. I am trying to call:

this.grdView.Columns[0].Visible = false;

But I get an index out of range error. And when I call, this.grdView.Columns.Count I get 0.

I have tried this on several events including: grdView_RowDataBound

View 3 Replies

Hide FooterTemplate For Repeater?

Mar 15, 2011

So I have a custom repeater where I write the footer in the Custom control here is the code :

[ParseChildren(true)]
[PersistenceMode(PersistenceMode.InnerProperty)]
[DefaultProperty("Text")]
[ToolboxData("<{0}:CustomRepeater runat=server></{0}:CustomRepeater>")]

[Code]....

So as the footer is writing programmatically, I would like to hide the FooterTemplate for somebody who use the custom repeater.. I was thinking [PersistenceMode(PersistenceMode.InnerDefaultProperty)] will do that but apparently not..

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved