---
title: "How to access row data from a MouseLeftButtonDown event on a textblock, in a gridview"  
description: "How to access row data from a MouseLeftButtonDown event on a textblock, in a gridview"  
author: "Anonymous User"  
published: 2015-02-24  
updated: 2015-02-24  
canonical: https://www.mindstick.com/forum/12975/how-to-access-row-data-from-a-mouseleftbuttondown-event-on-a-textblock-in-a-gridview  
category: "asp.net"  
tags: [".net", "asp.net", "html", "mvc", "gridview"]  
reading_time: 1 minute  

---

# How to access row data from a MouseLeftButtonDown event on a textblock, in a gridview

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to modify [data](https://www.mindstick.com/articles/13050/salesforce-aiming-to-dominate-predictive-analytics-with-data-science) in rows in a [gridview](https://www.mindstick.com/articles/873/update-delete-edit-gridview-in-asp-dot-net) which I have pulled from a database.

The data is being bound to each gridview [column](https://www.mindstick.com/forum/33860/how-to-calculate-column-summary-in-sql-server) like the following.

```
<GridViewColumn Header="Status"
Width="120" util:GridViewSort.PropertyName="Status">   
<GridViewColumn.CellTemplate>       
<DataTemplate>           
<TextBlock Text="{Binding Path=Status}"
FontWeight="Bold" MouseLeftButtonDown="TextBlock_MouseLeftButtonDown_1"/>       
</DataTemplate>   
</GridViewColumn.CellTemplate></GridViewColumn>
```

I have a MouseLeftButtonDown event on the textblock, and this fires when I click on the specific [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions).

```
private void TextBlock_MouseLeftButtonDown_1(object sender,
MouseButtonEventArgs e){   
MessageBox.Show("Hello");}
```

The issue I am having is that I can't find a way to [access](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china) the row data(such as the id, or the text in the row).

Is there any way to access all the row data from within the [click event](https://www.mindstick.com/forum/424/how-to-call-form_paint-event-on-button-click-event)?

Thanks

## Replies

### Reply by Anonymous User

Try This:\

```
  private void TextBlock_MouseLeftButtonDown_1(object sender, MouseButtonEventArgs e)    {        TextBlock textBlock = (sender as TextBlock);        string text = textBlock.Text;// Text in the TextBlock        object datacontext = textBlock.DataContext; // datacontext, Entire row info    }
```

\


---

Original Source: https://www.mindstick.com/forum/12975/how-to-access-row-data-from-a-mouseleftbuttondown-event-on-a-textblock-in-a-gridview

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
