Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 31st, 2011, 06:19 AM
Authorized User
 
Join Date: Jan 2011
Posts: 89
Thanks: 1
Thanked 0 Times in 0 Posts
Default Add to Hyperlink Grid View cell programatically

I have a databound grid view to which I added a hyperlink field to from the Fields dialog on the first column.

For each row I want to run some SQL that will return a count of records and add it to the end of my hyperlink field text so this can be seen from the grid view without having to go into the page via the hyperlink.

Here is some test code I was trying to get working but this replaces my hyperlink field instead of adding to it (it seems to add correctly to the bound fields).

Code:
 Protected Sub GridView1_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then
            e.Row.Cells(0).Text &= " (0)"
        End If
    End Sub
My other problem is, instead of hard coding "(0)" I need to pickup the EventID from the grid view to run my SQL that gives me my count but cant seem to get it possibly becaus it's visible property is set to false? I think using the code below I can only pickup post rendered columns.

Any help would be greatfully recieved!





Similar Threads
Thread Thread Starter Forum Replies Last Post
Find grid view cell by name AlexW ASP.NET 4 General Discussion 0 July 17th, 2011 09:08 AM
Add window content into Grid cell sektor Windows Presentation Foundation 0 January 14th, 2009 10:17 AM
how data grid of vb.net add cell color Nuwang Forum and Wrox.com Feedback 0 September 10th, 2008 08:36 PM
Add Rows to Grid View dpkbahuguna ASP.NET 1.x and 2.0 Application Design 0 March 19th, 2008 04:05 AM
Help Grid View Drop Down List, view all jskinner123 ASP.NET 2.0 Basics 0 November 25th, 2007 06:25 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.