.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 of users with phone numbers

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

Hey Guys,

I'm creating a list of departments as linkbuttons, when clicked these linkbuttons bring up a list of people in that department in a gridview and thanks to some other peoples help this is working great. The next step for me is to get the phone number to display in the column next to their name, it sounds like an easy thing to do as I've pulled phone numbers accross from AD before but just can't get it to work now!

The end result I'm hoping for would be like:

Charlie Brown | 01234 567890

Mona Lisa       | 01234 567890


My code is:

    class Employee
        public string Name { get; set; }
        public string Number { get; set; }
    class EmployeeList : List<Employee>
protected void LinkButton1_Click(object sender, EventArgs e)
        SearchResultCollection results = null;
        EmployeeList elst = new EmployeeList();
            string path = "LDAP://server.company.company.company/ou=company,DC=company,DC=company,DC=company";
            DirectoryEntry entry = new DirectoryEntry(path);
            DirectorySearcher mySearcher = new DirectorySearcher(entry);
            mySearcher.Filter = "(&(objectClass=user)(|(department=IT*)))";
            results = mySearcher.F

View Complete Post

More Related Resource Links

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?

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

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

how to get Active Directroy users into Windows Phone 7 Series.

hi,  how to show windows server 2003/2008 Active Directory User data in windows phone 7. in asp.net application we can use "System.DirectoryServices" Namespace. in didn't find this name space in .net compact framework. if  you found any API related to LDAP pls post it.

Edit users roles in gridview

I am trying to implement a page for an admin to edit other users details including roles and profile. I have a custom profile provider that stores data in database. My implementation is a page that shows username and allows an admin to reset user password, unlock users and approve and disapprove the users. I wanted to add a column in the gridview to allow the admin to remove or add a user to a role with the constraint that a user should be added only to one role.Any idea please?

Regular Expression for Canonical address format for phone numbers?

The canonical address format is a universal (international) phone number format and it's pattern is as following:

+ Country/RegionCode (AreaCode)SubscriberNumber

+1 (425) 555-0100

I need a regular expression that supports this?

Chart Control getting numbers from GridView, but just duplicates


I have a gridview that I loop through to get the x and y values of the chart control, and upon the first execution of this code, it looks great.  But when the page posts back and it "refreshes" data, the original points on the chart control are still there, as well as the new values.

Is there any way to "delete" all data in the chart control to ensure this doesn't happen?  I can't seem to find any resources to help me out with this.

Thanks in advance. :)

Gridview display users and personal profiles



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.)



looking for 7 digit phone numbers


How would I write a select statement to locate phone numbers that only contained 7 continuous digits?  I'm trying to locate numbers that were entered into the database without the area code.  Is there code that I could use to return only phone numbers that have 7 digits and no more?

Lee Markum

Copy phone numbers from results grid to excel, numbers have leading 0


Hi I need to copy a column of phone numbers into excel they should be treated as text however excel wants to treat it as a number.

Is there anything I can do to force excel to treat the copy and paste from management studio as text and retain the leading 0?

Inplace Edit in GridView

In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.

GridView Confirmation Box Using JQuery BlockUI in asp.net

JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.

Textbox Editable GridView in ASP.NET

This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.

AJAX GridView Checkbox Select All in ASP.Net

In the previous article GridView Select Multiple Rows you learnt the multiple row selection in GridView control. Here you will get the C# code sample to select all the gridview rows using single checkbox server control. You can highlight the selected rows with different color and Font state Bold. If you want to use the selection values on different ASP.Net

AJAX GridView Paging and Sorting using C# in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.

GridView Paging Using Ajax in ASP.Net

To enable the GridView Paging and Sorting to update the GridView Data without refreshing the ASP.Net web page AJAX Extension controls are used. UpdatePanel is used to hold the GridView control that triggers the events for the controls placed inside it. By Default UpdatePanel triggers the asynchronous postbacks for its child controls.
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