.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

Fill Gridview Based On Rights

Posted By:      Posted Date: October 10, 2010    Points: 0   Category :ASP.Net

I have a master table that will hold the information for publications for my company.  Not all of the publications can veiwed by all users.  What I am trying to figure out is how can I load all of the publications that the user is allowed to see into one grid view table.  For example: If Mary logs in she will only be able to see Accounts publications; if Sally logs in she can see General and Legal publications and if John logs in he can see IT, Legal and General publications.

I figured out how to do it with separate gridview tables on a page based on the roles.  I would make a gridview viewable if the user was in that role.  But I would really like to put all of this in one gridview if that is possible.  Does anyone have any ideas as to how I can do this?

View Complete Post

More Related Resource Links

5 GridView Themes Based on Google's Personalized Homepage (igoogle)

One of the silly features I have found that I like about igoogle is how the pages color palette changes depending upon the time of day. So as the day progresses from morning to afternoon to evening the colors on the page change as well. Like I said, I know this is a silly feature, but I like it. And I have asked around a little bit and seems like other people like it to. To get a better idea of how the colors change, here are the background images from a few of the HTML elements.

Insert data based on gridview user value on row.. how to



I have three column comes from database table(Table1) and one column is for entering data for the user let us consider it look like this 

ItemNo ItemName Qty  uservalue

001       A               50       20

002       A               20       5

003       B               50  

004       C               60      10

005       D               40 

006       E               90      15 


If its 300 row from database to gridview it will show 50 record with page navigation..

What i need is i need to insert data in to database table which gridview row has user value..

The output of the another table(Table2) will look like this after insert

ItemNo ItemName   uservalue

001       A                    20

002       A                      5  

gridview help on each dynamic row solve this show values based on all columns

<asp:GridView style="Z-INDEX: 101; LEFT: 1px; POSITION: absolute; TOP: 183px" id="Gridview1" runat="server" Width="613px" Height="127px" ForeColor="Teal" Font-Size="12pt" Font-Names="Palatino Linotype" Font-Bold="True" Visible="False" BorderColor="Transparent" AutoGenerateColumns="false" CellSpacing="2" GridLines="None" OnRowCreated="Gridview1_RowCreated" SelectedIndex="5" ShowFooter="true" OnRowDataBound="Gridview1_RowDataBound"><Columns>  <asp:TemplateField HeaderText="ItemCode"><ItemTemplate> <asp:DropDownList id="DropDownList1" tabIndex=16 runat="server" AutoPostBack="True" DataValueField=" ItemCode " DataTextField=" ItemCode" ></asp:DropDownList></ItemTemplate></asp:TemplateField>  <asp:TemplateField HeaderText="ItemName"><ItemTemplate> <asp:DropDownList id="DropDownList2" tabIndex=16 runat="server" AutoPostBack="True" DataValueField="ItemName" DataTextField="ItemName" ></asp:DropDownList> </ItemTemplate> </asp:TemplateField>  <asp:TemplateField HeaderText="Category"&

how to fill asp:Gridview when mouse clicked on AJAXToolkit Calendar

how to fill asp:Gridview asynchronously from the SQL database when mouse clicked on AJAXToolkit Calendar(When calendar date changed by client) Pls Help me out.Hoping for quick response Thanking You

Get selected row value based on checkbox selected in gridview using jquery

Hi ,    i am having gridview with two columns.one column contains checkboxes and another column contains Name.i have given UserId to DataKeyNames in gridview.Now i will check some checkboxes in gridview and click on button GetData. whenver i click on button GetData i need to get datakey values of all the gridview rows whatever checked in gridview using JQUERYPlease help me i am new to JQUery

Inserting Records Based on Checkbox Selection in a Gridview

Using checkboxes, can the row of record(s) be inserted into a database? I am populating a Gridview. Done. A checkbox field has been added, when the user selects one or more rows, a submit button (which is not working) needs to inserting those records into a table. The insert statment will work outside of the page but is not working using the scenario I jut described. Is this task as I have outlined doable? txs Ayomide

Policy based management : what rights do ##MS_PolicyTsqlExecutionLogin## need

Hi, In order to run Policies on scheduled basis, what permissions should I grant to ##MS_PolicyTsqlExecutionLogin## login? Problem is: When I evaluate the policies myself, they dont fail, but when I schedule them, they fail reporting ##MS_PolicyTsqlExecutionLogin## login doesn't have access to <> database. Any help please?

Row-based SharePoint Gridview

Hello, I want to stylize a SPGridview as row-based. I can do it in ASP .Net as follows (this is sample code and doesn't have a meaning. I wrote here because of describing the problem clearly on programmer side): <asp:GridView runat="server" ID="myGrid" AutoGenerateColumns="false"> <Columns> <asp:TemplateField> <ItemTemplate> <table> <tr> <td> <b>Position:</b> <%#Eval("Position") %><br /> <b>Gender</b> <%#Eval("Gender") %> </td> </tr> </table> </ItemTemplate> </asp:TemplateField> </Columns> </asp:GridView> Of couse, Eval sections should match with SQL Columns names in query string. So I want to do same with Sharepoint Gridview. SPGridview supports item template too but the problem is how to bind data to Eval (or whatever in Sharepoint) sections. This problem seems to you silly but there is a big text field in a SPList and I want to show it under title using a webpart. I tried views also but I think SharePoint has "Column-based" logic. Do you have any suggestion?

hoq to fill gridview dropdownlist from another db table

Hi, I have a gridview which gets its data from a database table now i ghave added a dropdownlist to this gridview but this dropdown should get the data from another table and should set its value automatically with a foreign key from the  gridview i have added the code like below in my rowDatabound but it just loads 1 field and then how should i get the selectedValue according to the gridview id field?? Protected Sub Friends_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)             If e.Row.RowType = DataControlRowType.DataRow Then                 Dim conn As New SqlConnection(HttpRuntime.Cache("con"))                Dim sql As String = "select ID,ListName from FriendList order by ListName asc"                Dim cmd As New SqlCommand(sql, conn)                cmd.CommandType = CommandType.Text                conn.Open()             &

Disable child links in list.aspx : gridView based on some row condations


In the list.aspx page , Datagridview


I want to disable the links to the child table based on condition ,

let say if filed OrderDate is empty at row in table Orders I want to disable link to OrderDetailes for that specific row

How can fill 3D bars/cylinders with gradient fill based on the value? (SSRS 2008)


I need to create a 3D bar/cylinder chart where the bars are filled with Gradient based on the max height.  Like the hign mountains where the peak is white and below you have shades of green.  Gradient Fill on 3D Series only picks up the primary color and never see the secondary.

Ideally, I'd specify the 'low' color (say black) and 'top' color (say white) and the bars will have the gradient from black to the % of grey that corresponds to their height ratio.

If the max value is 100, a bar of value 10 will start from 100% black to 90% grey.  A bar of value 85, will start again from 100% black to 85% grey.

The data set is a matrix of X (number) ,Y (date) and Z (number) and could draw like a scatter plot but I have many similar high Z values in close proximity which hide themselves behind each other.

My aim is to be able to view the 3D chart from any angle and be able to see the peaks of same or similar heights.

Recommendations or alternatives?

Many thanks




gridview row color based on different values


lets say i have 10 customers total listed on customer table and i only want  to show the customers who bought something on the gridview. each customer has their own unique customer id# from 1 to 10.

if three of them bought something (lets say customer #1,5,8). those three records will be shown on the gridview.

i want to color the first row yellow, and second row red, and again third row yellow, and fourth row red, and so on.

how can i do this?

Custom Columns - Fill values based on value selected in a lookup column



I am working with Sharepoint 2007. I have a list of 130 buildings located in six different cities and three different provinces. I imported this list from an Excel spreadsheet. I also have a document library that contains various files associated with these buildings. I've added a custom column to the document library that contains a lookup field to the name of each building. I also have two additional custom columns that have the city and province. What I would like to accomplish is to have the city and province columns automatically be set based on the name of the building selected, such that these values are taken from the same row of this list as the building name.

Hopefully my question makes sense.

Thank you, James

How can a fill a cell in a gridview in a windowsform?


I have a gridview in a windowsform.
There are 4 columns (A, B, C and D).
I column D is a combobox.
How can I fill this combobox at form_load with the following data: --> 

Gridview column based on other columns


I realize this is a simple question.

I have a gridview with 3 columns, price, tax, and total (for example).

  I want the total column to contain price + tax. 

I've set all three columns to be templated, although maybe they don't need to be.  This grid is read-only. 

I'd like to do it in code and not in a Bind, because there are some other calculations I need to do for other columns and it's easier for me to do it in VB. 

Do I do this in pre-render for the label in column 3? If so, how do I access the contents of the other columns in that row? 



Round Gridview footer template textbox value based on this JavaScript



This is my aspx javascript to get total in gridview footer template.. its working fine

The problem is : some time it show footer value is 6.9999999999

I need 6.99 as a result how to achieve this.

Aspx page:-

<script type="text/JavaScript">
function updateControls(elementId)
 var parentElementRef = document.getElementById(elementId);
 var elementRefArray = parentElementRef.getElementsByTagName('INPUT');
 var textBoxTotals = 0;

 for (var i=0; i<elementRefArray.length; i++)
  var elementRef = elementRefArray[i];

  if ( (elementRef.type == 'text') && (elementRef.gridTextBoxType == 'calcTextBox') )
   var textBoxAmount = parseFloat(elementRef.value);
   if ( isNaN(textBoxAmount) == true )
    textBoxAmount = 0;

   textBoxTotals += textBoxAmount;

 if ( isNaN(textBoxTotals) == true ) 
  textBoxTotals = 0;

 for (var i=0; i<elementRefArray.length; i++)
  var elementRef = elementRefArray[i];

  if ( (elementRef.type == 'text') && (elementRef.gridTextBoxType == 'totalsTextBox') )
   elementRef.value = textBoxTotals;
// -->


protected void Gridview1_RowDataBound(object sender, Grid

Its a task which had never before... how to get column and design in gridview Dynamic based on value



I need to generate gridview based on table value... let us consider i have in my aspx page one dropdownlist in which i have binded somevale

for example: dropdownlist contain:- Item1

based on Item1 i have three table first table conists A,B,C,D value.

Second Table consist 1,2,3,4,5

Third Table consist (0.5,0.6,0.7) for 1, (0.7,1.0) for 2, (0.6) for 3, (0.8) for 4, and another(0.8) for 5

based on this three table i need to show girdview like this which is below

If its Item2 dropdownlist then row  and column of girdview will be any number based on first,second,third table value for Item2

like this if Item3 dropdownlist then row  and column of girdview will be any number based on first,second,third table value for Item3.

help me to achieve dynamic rows and column based on database value... 

Its a very help if you guys will give me code in asp.net C#....

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