.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

Gridview display users and personal profiles

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


I am trying to populate a gridview control to display the current registered users on the site.

I query various tables from the ASPDOTNET.mdb database in order have a list comprising of UserNames, Email address, LastLoggedOn, etc. This bit is fine and it displays all the details.

The part I'm having a problem with, is I would like to add the FirstName and LastName to each row also. But I'm not sure how to get at the record. In the profile table I have a column with this detail within plus other personal details but I only need to retrieve the names and display that in the gridview.

Cheers Rob.


ASP.Net version 3.5

Access Database provider ASPDOTNET.MDB

(setup exactly the same way as the sql express table structure.)



View Complete Post

More Related Resource Links

GridView inline Master/Detail record display

This code drop is part of a smash and grab series. If you're in a rush, you can just grab this code and insert it into your application, no understanding is required. When you have some time (ya, right) you may want to review the source code.

Display data in gridview dynamicallay

I have AD domain which has 100000 users, I want to display all the users in gridview controls.Actually it is displaying users in gridview after parsing entire domain which takes around 30 min. I want to display the users while loading itself.It is continously getting user information from AD domain and getting each user details, I want to display the users information which already queried instead of waiting till getting all users information

asp.net display data in gridview

i want to display data in gridview binded to a sql datasource
but the problem part is i want to bind a field of that datasource to a dropdownlist and when a item is selected in that dropdownlist then correcposnding to that data will be displayed in gridview...

display data into GridView from excel sheet

I have to display data from excel sheet into my gridview and also I need to figure out a way to store data into excel files from my web page. I am using C# 3.5, VS 2008.

Display Related Data in an ASP.NET GridView

Typically when you display a datagrid you will want to show data from a related table. There are 3 different ways to accomplish this with NetTiers. You can use a custom stored procedure, deepload functionality from the code behind, or a strongly typed datasource control. We'll provide an example of each

Want to create Page URL rewrite based on Users GUID and Display name?



I am using the asp.net membership. 

On my site I have a Profile.aspx page.

In the code behind of this page,  i get the logged in UserId (Guid) and pass

this to a method in my DAL. GetUserByUserId()


In my database I have a Table called Member which the method gets the data from

and displays details on the page about  the user.


What I want to happen is when they have logged in and are diverted to Profile.aspx,

the page URL shows www.MyWebSite/Profile/UsersName 

for example



is this possible. In my Member table I have FirstName and LastName columns or do I get the

name from the membership table.


even better would be they go straight to www.MyWebsite/JohnSmith.aspx


thank you for any help






display an icon in gridview - selectively


I've created an ExpenseReport application which allows users to attach receipts to Expense Report Lineitems. These are contained in a gridview using a template field:

<asp:TemplateField HeaderText="File" InsertVisible="False">
                    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                <asp:HyperLink ID="HyperLink" ImageUrl='<%# Eval("filename", "~/workflow/Images/attachment.jpg") %>'
                runat="server" NavigateUrl='<%# Eval("filename", "http://workflowserver/AtWork/workflow/ExpenseReport/retrieveattachment.aspx?attachment={0}") %>' Text="" />  

The trouble I have is that the 'attachment.jpg' icon shows for every lineitem (even one that does not contain an attachment).

I would like to be able to selectively display this icon or show a different icon if there is NO attachment.

Any suggestions would be greatly appreciated. I'm kind of stuck... ;-)

Thank You.

Gridview extends past edge of div and page when editing users


I have a gridview pulling all data from one user. This gridview has an edit button and when that is clicked the gridview becomes too wide for the div/screen and I get a scroll bar. Since this gridview can only have one user in it anyway is it possible to display each field on seperate lines instead?

How To display image in GridView as hyperlink


Hello Everyone 

Could someone please help me with a little issue....

I was able to save the image in the database as binary....... but now i don´t know how to display it in the GridView as a hyperlink.

I´ve read something about ImageField..... I´d appreciate any help .


Display 'Top Queries Over Previous 30 Days' to users


In the Site Usage Reports, there is a section for 'Top Queries Over Previous 30 Days'. I would like to display this information to users. 

Is there a existing webpart for this? 
Is the data stored in a list that can be used for this purpose?


Steve Clark

Creating a gridview to allow editing of current users


I finally got membership and roles setup and seems to be working.

I have setup a page to allow the creation of a user and editing of roles for a user.

I would like to setup a page with a gridview that displays all users and what roles they are assigned. I remember running across someone else that was looking to do the same thing, but cant find it. Not sure if it was in this forum or online somewhere else.

But i found that i can use the  aspnet_Membership_GetAllUsers procedure in my db to get all the users, but how can i add the roles to each person and possibly setup the gridview so that each role they have, is displayed on their row in the gridview

So i would like to see something like this maybe more data displayed depending on the client request.

Username                 Email                 Last Login                          Roles

meofcourse               m

jpg files will not display in gridview on aspx page

I have an image object in a template of a gridview The datasource of the image object evaluates to the path of the jpg file. However, the aspx page displays a little red x instead of the picture. How do I get the image to display/Frank learning vs 2005

Display image icon in HyperLinkField of Gridview

 Hello everyone! Can someone please tell me how to display an image in a HyperLinkField of a gridview?  Instead of words, I just want to show a simple little icon that can be clicked on and pass a query string to the next page.  The first hyperlink field I have set up works perfectly and passes the querystring to the next page.   The second hyperlinkfield is my attempt at showing the image but it's giving me a squiggly and telling me "the element img cannot be nested within the element hyperlinkfield" I got this technique from this brief article   - I would like to accomplish exactly what it says it is suppose to do. Thanks!   <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="clientID"> <Columns> <asp:BoundField DataField="clientFirstName" HeaderText="First Name" /> <asp:BoundField DataField="clientLastName" HeaderText="Last Name" /> <asp:HyperLinkField HeaderText="More Info" Text="View more info..." DataNavigateUrlFields="clientID" DataNavigateUrlFormatString="Cli

Allowing Certain Users to Edit Certain Rows in a GridView

Here's my problem:    Different agencies are submitting projects to us, but I only want them to be able to edit their specific project (in addition, when they submit a project, they can only submit on behalf of their agency - but that may be a separate issue). Anyway, I can use the codebehind to show/hide the edit/delete/details buttons based on whether or not the user is authenticated using the following simple code in the Page_Init event:   If User.Identity.IsAuthenticated Then GridView1.Columns(0).Visible = True Else GridView1.Columns(0).Visible = False End If   To get what I want, though, I need to check each row (RowDataBound Event?).  The "SponsoringAgency" field will need to be validated against the user's credentials, and then the Edit button will be visible/invisible based on the result. Here's what I don't know how to do: 1.  When the user registers, have an additional field that asks and stores their agency information. 2.  I can't quite figure out how to get the SponsoringAgency value from the gridview.  I've tried a few tests using:   If e.Row.Cells(11).Text = "AgencyA" Then e.Row.Cells(11).Text = "TEST" End If   This does not work - the text isn't changed.  One of the possible problems is that I'm not sure I'm getting the right column in my grid

display image in gridview - unlucky with tutorials

I'm trying to display images in a gridview, but after following the examples of maybe 7 different tutorials I still haven't succeded. There are always some things that go unexplained. My latest attempt is according to this tutorial:http://www.aspdotnetcodes.com/Insert_Images_Database.aspxProblem No1: what exactly should I write in my ashx-file? Following the example in the tutorial this is the code so far:<%@ WebHandler Language="C#" Class="ImageHandler" %> using System; using System.Web; using System.Configuration; using System.Data.SqlClient; public void ProcessRequest (HttpContext context) { SqlConnection myConnection = new SqlConnection("DBPejganConnectionString1"); myConnection.Open(); string sql = "Select Image_Content, Image_Type from ImageGallery where Img_Id=@ID"; SqlCommand cmd = new SqlCommand(sql, myConnection); cmd.Parameters.Add("@ID", SqlDbType.Int).Value = context.Request.QueryString["id"]; cmd.Prepare(); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); context.Response.ContentType = dr["BildTyp"].ToString(); context.Response.BinaryWrite((byte[])dr["BildData"]); dr.Close(); myConnection.Close(); }Please give me a hint (or rather the answer) on what's missing. The rest of the problems comes later... :)

Attempting to use an HTTP handler to display pictures in gridview. It's not working, please help.

I am writing a web page that needs pictures displayed for each item.  The page works just fine except for the pictures.  I have a file called handler.ashx uploaded to the server as well.  It does not seem to be hurting anything, but it doesn't seem to help display the pictures either!  I am working with a MySQL database so I am thinking that the call for the data or the ashx page's structure itself are my problem.  I am using C# Express so there is no generic handler class to autoload and therefore my handler page is pasted together and I know the using statements are in the wrong place, but I'm new to this and I'm lost!  The following is my database table info (table is named: Yamaha), my handler.ashx page code, and the code for the final web page.  I have loaded ".jpeg" or "jpeg" into the field I added called "Image_Type"  since I have already uploaded all pictures as longblobs.  You can view the final web page here: http://www.88867honda.com/YamahaPtsSale.aspx Thanks in advance for any help, Melissa   Table info: Field TypeAttributes--> Null DefaultExtra--> Comments part_number varchar(15)  --> No     -->   description varchar(50)  --> Yes  NULL   -->   qty int(4)  --> Yes  NULL  

Problem with GridView display

I have a calendar control where a user selects a date and then inputs info into a FormView control. Underneath the FormView is a GridView that shows all data from the SelectedDate on the calendar control. However, when the date is selected, all the information from the table ( from all dates ) is displayed. Any ideas on why? Code is below and thanks:<asp:Calendar ID="calendarInstallDate" runat="server" BackColor="White" BorderColor="Black" DayNameFormat="Shortest" Font-Names="Times New Roman" Font-Size="10pt" ForeColor="Black" Height="220px" NextPrevFormat="FullMonth" TitleFormat="Month" Width="400px" onselectionchanged="calendarInstallDate_SelectionChanged" > <DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" ForeColor="#333333" Height="10pt" /> <DayStyle Width="14%" /> <NextPrevStyle Font-Size="8pt" ForeColor="White" /> <OtherMonthDayStyle ForeColor="#999999" /> <SelectedDayStyle BackColor="#CC3333" ForeColor="White" /> <SelectorStyle BackColor="#CCCCCC" Font-Bold="T
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