Solved

Customize a Role Grid View, bound to Roles.GetAllRoles

Posted on 2009-07-13
2
494 Views
Last Modified: 2012-08-14
Hello,
I have set up membership in an ASP.NET application.

I need to show all the Roles of the application in a GridView GV1.

so wrote in some event :
GV1.DataSource = Roles.GetAllRoles()
GV1.DataBind()

It worked fine, and the Roles are displayed in one column in GV1, having a header of ITEM.
I need to change the header Text to Role for Instance,
How can i do this?
thanks
I am using VB
0
Comment
Question by:Nyana22
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 41

Expert Comment

by:guru_sami
ID: 24845024
This is one way...there might be some more simple way which I might not be aware of:
Use GridView RowDataBound Event like below:

Protected Sub GV1_RowDataBound(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
    If e.Row.RowType = DataControlRowType.Header Then
        For Each cell As TableCell In e.Row.Cells
            cell.Text = "Role"
        Next
    End If
End Sub

Ref:
http://www.rosshawkins.net/archive/2007/04/15/adding-tooltips-to-gridview-headers.html.aspx
0
 
LVL 41

Accepted Solution

by:
guru_sami earned 500 total points
ID: 24845047
My bad...you don't need a For Each loop just set like below:
Assuming it as first column....i.e. index=0...

 If e.Row.RowType = DataControlRowType.Header Then
        e.Row.Cells(0).Text = "Role"
    End If
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question