CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2011

    Please Help, ButtonColumn in DataGrid returns empty string when I call .Text

    As the subject explains, I get an empty string when calling the .Text property. Refer below for snippet:

    <asp:datagrid id="dgVeryImportant">
    <asp:ButtonColumn Text="To Get">
    Public Sub GetEverythingFromDatagridEvenFunctionName
    Dim col As Int32 
    For col = 0 To e.Item.Cells.Count - 1
    'strValue is always empty!
    Dim strValue As String = dgVeryImportant.Items(col).Cells(2).Text
    End For End Sub
    The internet search advises to use Items(col).Cells(2).FindControl(..), the problem with that is FindControl finds the control by ID, BoundColumn doesn't allow you to insert an ID for it.

    Please assist..

  2. #2
    Join Date
    Jun 2005
    JHB South Africa

    Re: Please Help, ButtonColumn in DataGrid returns empty string when I call .Text

    Hi Khanyek..

    STOP SPAMMING the users...
    To email khanyek, you can use this online form:

    OR, by email:
    mailtoi've a good mind to leave the Mail here for spam)

    This is the message:

    Hello friend..

    Been a while huh..

    Please help. I'm running through a datagrid item (row), and one of my cells is a buttoncolumn, which apparently returns an empty string when I retrieve the text from it (Item(..).Cells(..).Text).

    How would I go about getting the right value?

    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.