---
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: 2013-09-25  
updated: 2013-09-25  
canonical: https://www.mindstick.com/forum/1528/how-to-access-row-data-from-a-mouseleftbuttondown-event-on-a-textblock-in-a-gridview  
category: "wpf"  
tags: ["wpf"]  
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 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](https://www.mindstick.com/articles/336036/explain-about-html-header-body-and-footer-tags)="[Status](https://www.mindstick.com/articles/157184/check-lic-policy-status-online-by-policy-number)" Width="120" util:GridViewSort.PropertyName="Status">

<GridViewColumn.CellTemplate>

<DataTemplate>

<TextBlock Text="{[Binding](https://www.mindstick.com/blog/146/dynamic-binding-in-c-sharp) 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.

[private](https://www.mindstick.com/blog/11097/java-access-modifiers-the-public-and-the-private-modifiers) 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

Hi JayPrakash,

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/1528/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.
