Hide a column in datagridview but still access data in column.

Hi
I am trying to hide a column in a datagridview but at the same time, retain access to it's data.  I can hide it by setting columns("name").visible = false - but then I cannot access the data in that column.  I also tried setting it's width to zero, but you still see the column as a sliver and it doesn't look very nice.
Anyone know a way to accomplish this?
note: using VB 2005.
Thanks
Matt

Occurs on second msgbox in above example
System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
  Source="Docuclerk -  Document Retrieval system"
  StackTrace:
       at Docuclerk.MainForm.SearchData(String strsql3) in C:\AIM\VB\AIM Image Management\AIM Image Management\MainForm.vb:line 254
       at Docuclerk.MainForm.btnSample_Click(Object sender, EventArgs e) in C:\AIM\VB\AIM Image Management\AIM Image Management\MainForm.vb:line 627
       at System.Windows.Forms.Control.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnClick(EventArgs e)
       at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
       at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ButtonBase.WndProc(Message& m)
       at System.Windows.Forms.Button.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(ApplicationContext context)
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
       at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
       at Docuclerk.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
       at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()

Similar Messages

  • I have a macbook pro and apple tv2. My problem is that my hard drive is full. What is my best option to empty movies off of my macbook but still access them through atv2?

    I have a macbook pro and apple tv2. My problem is that my hard drive is full. What is my best option to empty movies off of my macbook but still access them through atv2?

    ok. I do have a time capsule but if I move itunes on to it how do I sync my ipods and iphone? Or can I have my Itunes account on both and just move my movies to the time capsule?

  • How To: Lock a folder to prevent it being deleted but still access it?

    How can I lock a folder to prevent it from being moved or trashed but still have access to move/add folders within that folder?
    The scenario is that we have a daily jobs folder and a final jobs folder. The daily jobs folder was accidently moved into an active job folder. I want these folders locked down so this cannot happen but when I use the lock feature nothing can be moved in or out of that folder.
    Under OS9 the locked box specifically said "cannot move, rename or delete this item" yet you could add or delete items to that folder all day long.
    If I try this with OSX I need to authenticate each bloody time! I just want to lock a folder down and have it accessable by anyone, anywhere, anytime without the need to type a password 80 times a day. HELP ME PLEEZE
      Mac OS X (10.4.3)  

    Read only access will prevent the addition or removal of items in the folder you set the permissions on; the folders below that one have different access settings, which can be less restrictive than those for the folder you set it on.
    For example, if folder A contains B and C, and B allows Read & Write access but A allows Read Only access, items can be added and removed from B, but B itself cannot be moved out of A, and other items cannot be moved in to or out of A. If a folder your account has Read access to is inside a folder which your account doesn't, you can use the Finder's Go to Folder command in the Go menu to navigate to it if its path is known.
    (15304)

  • How do I keep my media on an external hard drive but still access it in iTunes?

    I just recently purchased a new Macbook Air and I had my itunes media library on an external hard drive. How do I access my itunes media on the macbook air from the external hard drive without transferring all the media onto my macbook air? I also want to be able to add and download media to my itunes and have it saved on my external hard drive. I have been trying to figure this out for weeks and need some assistance. Any advise would be greatly appreciated. Thanks in advance.

    hey, basically i had the same problem as you. i had all of my itunes on an external hard drive and just bought a macbook pro, so here is what i was told to do....plug in the external hard drive to your MBA and then when you open itunes hold down the option button while you click and hold it down till you see a pop up window, it will ask you what library you want to use, click choose library and choose the itunes file that is on your external hard drive. and then all of your stuff will be in the itunes.
    what i have seemed to run into though is, when the external hard drive isn't plugged in itunes won't open unless you choose another library or plug in the external hard drive. - my question is this, should i open another library on my macbook pro's internal hard drive so i can at least look at itunes when i don't have my external hard drive connected. my old macbook did this, it would point to another library on my macbook and i would still be able to see all of my media but couldn't play it without the external hooked up, is there a way to do this on lion?
    i hope i was able to answer your question sam and hopefully can have my question answered too.
    thanks!
    - sorry sam, don't mean to hijack your thread but hopefully it will help us both - i don't want to store any media )movies, music, podcasts, apps, any of that stuff on my macbook pro's hard drive, so say there is a way to get itunes to open without my external hooked up and i can still see my media, or not see my media and i want to download a song or a app that i see when i am not near my external....what is the easiest way to get that file onto the external and not have it taking up space on my macbook pro's hard drive? sorry for all the long questions
    Message was edited by: thenumbersarebad - thought of one more thing - sorry

  • URGENT:Must delete my alias but still access that old email in/out in past.

    I MUST immediately no longer send or receive email from an alias email name i have set up on my dslextreme ISP.
    I know i can do that if i go onto that ISP and 'delete' that alias. Then that alias will no longer be used to either send or receive, they said. OK.
    But definitely want and need to still be able to see all the old email I have ever sent or received (over the years) in the past.
    Doesn't seem right that it might be lost, all my old in and out records, and not viewable ever again in my 'MAIL' aplic.
    I want to still be able to access and read all my old in &/or out mail.
    My ISP tech support said I could delete that alias on their end, but if I maintained it on my Apple 'MAIL' it would be constantly searching for an inactive address and sending me messages every day that it was unable to find that account. That's okk, I guess, now that I think about it. I just worry that I must somehow still be able too read all my old past in and out letters. If I can do that I'll be happy.
    Doesn't seeem right that if I make an email address deleted or inactive on MAIL Prefs, that I can never see those old messages again.
    PLEAse help. Need to do it immediately.
    Thanks

    If the account was a POP type account, your emails should already be stored locally. If the account was an IMAP type account, then it is saved on the server, so if you will lose access to the server, you should copy them locally. If you don't know, you should be able to tell by opening Mail preferences to the Accounts pane. Select the account in the sidebar and look under +Account Information+. The +Account Type+ should be shown there.
    If it is IMAP, you can copy your email to your local drive.
    Look to the bottom of the Mail window sidebar. You should see a plus sign. Click that and select +New Mailbox+. In the drop down dialog box, for Location select *On My Mac* and name it. A good name might be "email from (alias)" or something that refers to that alias. You should see a new +On My Mac+ section appear in the Mail window sidebar, if you did not have one before.
    Repeat the plus sign +New Mailbox+ command again and again, to create folders (mailboxes) within your previously created folder. Now copy your email as you see fit from your existing account email folders to your +On My Mac+ folders.

  • How to hide currency amount 0,00 but with icon_failure display in column?

    Hi Experts,
    I am doing with CL_GUI_ALV_TREE. The report will display tree hirarchy with currency amounts in columns.
    When there is 0,00 amount in column, I'd like to display an icon_failure (like a flash) in that column without 0,00.
    It works in initial screen:
    I cleared its currency so 0,00 will not appear.
    But when I click next page button in toolbar (display columns in next page..), I have to call CHANGE_NODE method. In this case, clear currency cannot work any more. 0,00 with icon_failure display together in one column.
    So is there any solution to display icon only without 0,00?
    Thanks,
    Ying

    Luckily team member heped solve it..
    if there is no change in field catalog when I shift page, my logic would be fine. However I do have change in field catalog and call CALL METHOD go_tree->set_frontend_fieldcatalog to update it. That is the problem...
    I should first call CALL METHOD go_tree->get_frontend_fieldcatalog to get it before update it. Then my logic works! (but without get method, my field catalog can update well too!!)
    isn't it a bug of ALV? ...sigh...

  • Limit Internet but still access network

    I just purchased airport extreme base and am trying to configure my network. I have a hard drive connected via usb. My goal is to have my eMac and my Mac Mini access both Internet and my network hard drive, wired and wireless respectively. Also a laptop and PC both running XP SP2 to access network hard drive but NOT internet, wirelessly.
    Is it possible to disable Internet for the PC's on the airport side through the airport utility?
    Thanks

    I'm not sure how to do it with the AirPort Extreme configuration, but you could do it by configuring the PCs with appropriate LAN static IP addresses without including DNS server entries.

  • 5s stopped accessing email for only one account but still accesses it for others on same server

    My 5s quit accessing one email account but continues to access the other account.  Both accounts use same provider and servers. Any ideas on what has happened? Have re-entered account several times as well as powered down the phone.

    Go into Settings>Mail, Contacts, Calendars and select the account you are having trouble with. Select the incoming mail server and double-check the username and password. Verify it is being used in all of the correct locations. If it is sending alright, then you do not have to worry about the SMTP server settings.

  • Reinstall OSX Mountain Lion but still access Backup

    Mountain Lion has become unstable on my Solid State Harddrive (Corsair CSSD F120GB)  and I'm plannng to erase and start from scratch.   Had problem before with doing this and then being unable to access my Time Machine backup.    Permissions issue.   I'm aware that I don't need to erase but after two years, I'd like to have a clean slate and try something new.   Just don't want to lose access to my docs and pictures.
    Plan right now is to boot into recovery mode (option key during boot), go into Disk Util and choose erase.  Then back into Reinstal OSX.   Same hard drive but fresh copy of OSX.   Will I be able to access backup in Time Machine?

    No reason why not if you use the same username and password for the admin account.
    Install or Reinstall Lion/Mountain Lion from Scratch
    Be sure you backup your files to an external drive or second internal drive because the following procedure will remove everything from the hard drive.
    Boot to the Recovery HD:
    Restart the computer and after the chime press and hold down the COMMAND and R keys until the menu screen appears. Alternatively, restart the computer and after the chime press and hold down the OPTION key until the boot manager screen appears. Select the Recovery HD and click on the downward pointing arrow button.
    Erase the hard drive:
      1. Select Disk Utility from the main menu and click on the Continue button.
      2. After DU loads select your startup volume (usually Macintosh HD) from the
          left side list. Click on the Erase tab in the DU main window.
      3. Set the format type to Mac OS Extended (Journaled.) Optionally, click on
            the Security button and set the Zero Data option to one-pass. Click on
          the Erase button and wait until the process has completed.
      4. Quit DU and return to the main menu.
    Reinstall Lion/Mountain Lion: Select Reinstall Lion/Mountain Lion and click on the Install button.
    Note: You will need an active Internet connection. I suggest using Ethernet if possible
                because it is three times faster than wireless.
    However, Time Machine will consider this a new device so it will want to make a new backup. Please visit Pondini's Time Machine FAQ for help getting Time Machine to continue using the old backup.

  • User is locked in R/3 but still access the application through portal

    We are currently on NW2004s SP10 .
    We locked the User A in R/3 SRM backend system and from Enterprise Portal the same User A login and try to access the SRM application in backend . The system is allowing to access which we want to prevent .
    The authentication ticket type is "SAP Logon Ticket" .  The User A is trying to access ITS services through Portal.
    Do we have specific SSO parameter which needs to set in backend SRM application .
    Thanks
    Chandrashekhar K

    Hi
    We have maintained the following profile parameter for SSO in our SRM system . From portal we are accessing the SRM system
    login/accept_sso2_ticket          1          
    login/certificate_request_ca_url     https://tcs.mySAP.com/invoke/tc/usercert               
    login/certificate_request_subject     CN=&UNAME, OU=&WPOU, O=mySAP.com User, C=DE               
    login/create_sso2_ticket          0               
    login/disable_cpic               0          
    login/disable_multi_gui_login          0          
    login/disable_multi_rfc_login          0               
    login/disable_password_logon          0               
    login/failed_user_auto_unlock          0          
    login/fails_to_session_end          3               
    login/fails_to_user_lock          3          
    login/isolate_rfc_system_calls          0               
    login/min_password_diff               1          
    login/min_password_digits          0               
    login/min_password_letters          0               
    login/min_password_lng               6          
    login/min_password_specials          0               
    login/multi_login_users               HP          
    login/no_automatic_user_sapstar          1          
    login/password_change_for_SSO          0          
    login/password_charset               1          
    login/password_expiration_time          60          
    login/password_logon_usergroup                         
    login/password_max_new_valid          0               
    login/password_max_reset_valid          0               
    login/system_client               400
    login/ticket_expiration_time          60
    login/ticket_only_by_https          0
    login/ticket_only_to_host          0
    login/ticketcache_entries_max          1000
    login/ticketcache_off               0
    login/update_logon_timestamp          m
    Please suggest as to change any parameter value . We want to restrict the user to access SRM system from portal if he is locked int e SRM system.
    Thanks

  • Convert Dial-up accounts to Internet-only but still access vis POP

    I have 5 AT&T Dial-up accounts that I would like to convert to internet-only. Some of these accounts were first established in the late 1990's, and some were set up in th early 2000's. I have the account numbers for each, and all of the passwords and security questions & answers. All of these accounts were converted (if that is the right word) to Yahoo in May of 2010. Each account has one or more sub-accounts. I have seen forum posts that indicate you lose the ability to access email accounts via POP, which will not work for me as these are corporate users who want to use Outlook to access their email. I would like to know who I can talk to (not the typical run-of-the-mill customer service person who really knows very little) to establish the process I need to go through to move from Dial-Up to Internet-only accounts.

    Hi,
    In System Preferences>Network, highlight or Show Internal Modem>PPP tab>PPP Options button... Prompt every xx minutes.

  • JSF: how to avoid validation but still submit data to the "business layer"

    Greetings
    The scenario is common and sounds like this:
    1) We have 2 forms, each with some fields marked with required = "true"
    2) Navigation between these two should be unlimited and data should be submitted to the (stateful) business layer every time we move from one to another, without validation,
    thus all of my h:commandButton tags are marked with type="submit"
    3) On final "save" command data should be validated and sent to DB
    Now,
    - if i avoid required attributes on fields, everything works fine except validation ofcourse
    - if i add immediate="true" where needed, data gets lost when i navigate from one page to another
    thanks a lot in advance

    Use an EL expression for the value of the required attribute. Note that the important thing is its value during the subsequent request. If you have other types of validations you may have to use custom validators.

  • How to save xml and xsl function to a data grid column

    hi. wondering, i have a xml and a xsl file, and have the transform class, and so need to save the xml and the xsl file, and display the results on a particular data grid column and to loop through the data grid columns. so, how do i use the xml save function
    class, any examples or point me to articles, where i can read how to do this. need to display a file, with a different colour and font. any ideas. thanks. marvin.hi. need to save a xml and xsl file and display the results on data grid. how do i do this. any
    sample code or articles i can read about thanks. marvin.
    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

    
    Hi.
    Okay, well, did ask on the msdn forums, and some one replied, and so, will paste the code he suggested.
    But getting a lot of errors.
    Can you help me out.
    Where am I going wrong.
    So, I can then get this to work, then it shows the colours and the fonts on the specified data grid.
    Can you help.
    Want to get this working and passed today if possible.
    Will pasate the code and the errors below.
    Can you help.
    Where am I going wrong.
    Marvin.
    // Set up the data set.
    DataSet ds =
    new
    DataSet();
    // Set up the data table.
    DataTable dt =
    new
    DataTable();
    // Ad the data table to the data set.
        ds.Tables.Add(dt);
    // Write the xml document to the data grid column.
        ds.WriteXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\CurrentCount.xml");
        ds.WriteXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\OnOrder.xml");
        ds.ReadXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\CurrentCount.xml");
        ds.ReadXML(@"c:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\OnOrder.xml");
    // Set up the data table and the data set and set to 0.
        dgvDisplayData.DataSource = ds.Tables[0];
    Error      1              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                215        
    18           WoodStocks
    Error      2              Invalid token ')' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                215        
    21           WoodStocks
    Error      3              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                219        
    16           WoodStocks
    Error      4              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                221        
    16           WoodStocks
    Error      5              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                222        
    15           WoodStocks
    Error      6              Invalid token '(' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                223        
    15           WoodStocks
    Error      7              Invalid token '=' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                227        
    31           WoodStocks
    Error      8              Array size cannot be specified in a variable declaration (try initializing with a 'new' expression)               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                227        
    43           WoodStocks
    Error      9              Invalid token ';' in class, struct, or interface member declaration               
    C:\Docs\Education\CertificateFourProgramming\CoreInfrastructure\DevelopingXMLApplications\Assignments\WoodStocks\WoodStocks\frmData.cs                227        
    45           WoodStocks
    Can you help me out.
    Thanks.
    http://startrekcafe.stevesdomain.net http://groups.yahoo.com/groups/JawsOz

  • Accessing data from other SAP system

    Hi experts
    I need to access data from one SAP system from other.  My requirement is , perform applications (programs) in some SAP system, but using/accessing  data from other SAP system .
    For example, when we press F4 we get the match code (search help) for the field ;  that window is alredy created by SAP and it shows the data for that field . Of course the application (ike any other program/application) read the data from the SAP system is being executing ;  well i need execute that match code but show (taking) the data from other SAP system;  i not refer to other MANDT in same system but other SAP system.
    The communication between SAP1 system and SAP2 system is already created from BASIS.
    My doubt is how can i  execute that standard application (search help) but 'invoke' to standard application this take data from other system ?
    I guess i can create Z search help wich call a Z Function (RFC) to get the data required from the other system ;
    or maybe enhance the standar search help to call that Z RFC ;  but standard application search help is already created and this access the data in several ways or places of code , and this has severals sub-windows and search features ; and i just need execute exactly same search help but accesing data from the other SAP system ; so my doubt is, is there some way to indicate to SAP the applications always (wherever) these applications acces the data do it but from other SAP system, 
    like if we 'redirect' the Data Base to other SAP system. 
    SAP1 applications are being executing  -
    >   but all data (records) are taking from SAP2
    Maybe the first suggestion is simply why do not we execute applications in SAP2 instead SAP1 , that's because the version package in SAP2 system (where we have the data) does not support some (non SAP) applications we need to use.
    Excuse the long thread.  Does somebody can help, any idea ?
    Best Regards
    Frank

    Hi Frank,
    Below are my thoughts, these are only conceptual and haven't had an opportunity to try these possibilities, also not sure if this is the right thing.
    1) Create an entry in DBCON using TCode: DBCO for the Database of system SAP2. Now in the application of SAP1 use the "SET CONNECTION" construct as the very first statement, so that consecutive SQL statements will point at the DB of SAP2.
    2) I have read somewhere that the Work Processes are connected to the Default database and i am not sure if you can change this setting, but if you can and provided you have have multiple application servers in your SAP1 landscape, then pick one of the application servers and change the settings on the WP to point at the DB of SAP2, you have the end users login to this particualr app server.
    3) If there are multiple app servers in SAP1 landscape, then choose one of the app servers and change the default database setting to point at DB of SAP2.
    Regards,
    Chen

  • I am trying to hide a column in a gridview but need access to the data in these fields.

    I have a gridview with columns that I want to hide but still need to access this data at the row level. What is the best way to achieve this? (Using Visual Studio 2013)

    OK - I posted the question then posted the answer. I tried to find the answer and discovered the question was asked a
    lot, and many had 30 or more posts on the question. Since I spent way to much time looking at forums/discussions and figuring it out, I thought that I should repost the question then answer it. Hopefully if someone stumbles on it it might save
    them some time.
    I tried setting column widths, setting columns to visible=false before a bind (and after a bind), CCS, TemplateFields etc etc. All had problems either in the display, paging or retrieving the data in the gridview events (RowCommand & RowDataBound).
    I am not saying the others won't work but this is the way I got it to work. As with most coding issues once you have the answer it looks pretty simple.  
    First of all forget about trying to hide columns - Use DataKeyNames in the GridView. 
    Here is what I am trying to do - Based on the data in the "hidden columns" in the row, I want to manipulate how the Grid will appear. (Buttons will or will not appear)
    SQL:
    Select [FruitID], [StuffDesc], [ActionAFlag], [ActionBFlag] from [Friut] ORDER BY [StuffDesc]
    ASPX:
          <asp:gridview id="Gridview1"  AllowPaging="True" runat="server" 
                        autogeneratecolumns="False"
                        onrowdatabound="GridView1_RowDataBound"  
                        onrowcommand="GridView1_RowCommand"
                        Datakeynames="FruitID, ActionAFlag, ActionBFlag">
              <Columns>
                  <asp:BoundField DataField="StuffDesc"  Headertext="Made up Stuff" />
                  <asp:ButtonField ButtonType="Button" CommandName="FireA" Text="Action A" />
                  <asp:ButtonField ButtonType="Button" CommandName="FireB" Text="Action B" />
              </Columns>
          </asp:gridview>
    ASPX.VB
    RowDataBound fires before each row is rendered to the Gridview. The data in ActionAFlag and ActionBFlag will determine which buttons show. If the data in field ActionAFlag is 1 then "Action A" button shows; if field ActionBFlag
    is 1 then "Action B" shows. First it checks to see that you are dealing with a DataRow, (not Headers or Footers). Note variable "rowcounter" [I could not figure out how to get the row number from GridviewrowEventsArgs so I fudged it by
    using a global variable and setting it to 0. Each time the page is rendered the Rowcount is automatically set to 0]
        Protected Sub GridView1_RowDataBound(ByVal Sender As Object, ByVal e As GridViewRowEventArgs)
            If e.Row.RowType = DataControlRowType.DataRow Then
                Dim AShow As String = Gridview1.DataKeys(rowcounter).Values("ActionAFlag").ToString
                Dim BShow As String = Gridview1.DataKeys(rowcounter).Values("ActionBFlag").ToString
                If  AShow <> "1" Then
                    e.Row.Cells(1).Text = " "
                    ' -- Blank Action A Button ---
                End If
                If BShow <> "1" Then
                    e.Row.Cells(2).Text = " "
                    ' -- Blank Action B Button ---
                End If
                rowcounter = rowcounter + 1
            End If
    RowCommand fires on page changes or if a button on a row is clicked. I want to capture the FruitID and execute the appropriate button action. Here I can get the Row Index
        Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)
            If e.CommandName = "FireA" Or e.CommandName = "FireB" Then
                Dim index As Integer = Convert.ToInt32(e.CommandArgument)
                Dim FruitID As String = Gridview1.DataKeys(index).Values("FruitID").ToString
                If e.CommandName = "FireA" Then
                    MsgBox(" In FireA / FruitID = " + FruitID)
                Else
                    MsgBox(" In FireB /FruitID = " + FruitID)
                End If
            End If
        End Sub

Maybe you are looking for