473,378 Members | 1,578 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Problem populating GridView!

Hey

asp.net 2.0

I have this GridView in my web page. My problem is that it get populated
with all the fields of the MembershipUser class. I thought only UserName
would be displayed, but it displays all fields

<asp:GridView ID="gvwOnline" runat="server">
<Columns>
<asp:ButtonField DataTextField="UserName" />
</Columns>
<EmptyDataTemplate>No users are online</EmptyDataTemplate>
</asp:GridView>

MembershipUserCollection onlineUsers = Membership.GetAllUsers();
gvwOnline.DataSource = onlineUsers;
gvwOnline.DataBind();

Any suggestions?
Oct 11 '06 #1
1 1350
If you want to only grab specific columns, you must set the "AutoGenerateColumns"
to false:
<asp:GridView ID="gvwOnline" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:ButtonField DataTextField="UserName" />
</Columns>
<EmptyDataTemplate>No users are online</EmptyDataTemplate>
</asp:GridView>
More information here:

http://msdnwiki.microsoft.com/en-us/...tecolumns.aspx

-dl

--
David Longnecker
Web Developer
http://blog.tiredstudent.com
Hey

asp.net 2.0

I have this GridView in my web page. My problem is that it get
populated with all the fields of the MembershipUser class. I thought
only UserName would be displayed, but it displays all fields

<asp:GridView ID="gvwOnline" runat="server">
<Columns>
<asp:ButtonField DataTextField="UserName" />
</Columns>
<EmptyDataTemplate>No users are online</EmptyDataTemplate>
</asp:GridView>

MembershipUserCollection onlineUsers = Membership.GetAllUsers();
gvwOnline.DataSource = onlineUsers;
gvwOnline.DataBind();
Any suggestions?

Oct 11 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Larry Grady | last post by:
Anyone up for a challenge? I've been struggling with this for a few days and was hoping someone could help me. Pouring through all the messageboards I just can't find the solution. We have a...
3
by: sck10 | last post by:
Hello, I am creating a form for users to enter information about a lab and the members of the lab. I have one form (FormView) that they use to enter information about that lab. The keyvalue is...
1
by: Isoaxis | last post by:
On the page in question I have a gridview that displays the list of all products in the Products table of the DB. That gridview is bound with a sqldatasource using Visual Studio's "wizards". The...
1
by: bill tie | last post by:
I have two dropDownLists A and B outside a gridView. A selection made in ddlA causes ddlB to be populated with data from the database. The gridView is populated with data according to a...
1
by: Greg Smith | last post by:
I am looking for examples for populating a GridView in code. I have a GridView that I want to show unbound when the form opens and then filled with different collections of data based on options...
0
by: koonda | last post by:
Hi all, I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my...
4
by: ASPnewb1 | last post by:
Hello, I have a 2-dimensional array created from the following text file: data1=asdfawe data2=2 data3=223d data4=22
1
by: Andy B | last post by:
I have a wizard with multiple steps in it. On the first step, I have a gridView that shows the users current input for that particular step. The GridView is bound to an in memory object. When I...
2
by: William LaMartin | last post by:
On webform, I am populating a GridView from a SQLDatasource based on a MySQL table named PIB. There is no vb code involved. Everything is done in the source for the aspx page, provided below. ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.