# Help with dataGrid

**URL:** <https://forum.kirupa.com/t/help-with-datagrid/182368>\
**Category:** flash\
**Created:** [March 17, 2006, 2:53pm UTC](https://forum.kirupa.com/t/help-with-datagrid/182368 "2006-03-17T14:53:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stennyb](https://avatars.discourse-cdn.com/v4/letter/s/8c91f0/32.png) [@stennyb](https://forum.kirupa.com/u/stennyb)\
**Post date:** [March 17, 2006, 2:53pm UTC](https://forum.kirupa.com/t/help-with-datagrid/182368/1 "2006-03-17T14:53:29Z")

</div>

Hi guys.

I am using an XML connector and a datagrid to display some data on the stage.

I have added a listener to the dataGrid to allow the user to click on cell.  
When the user clicks a cell the data in the cells of that row will be stored in global variable.

Here is my code below. When I try to trace the global variable i get an undefined. Can anyone explain why please and offer some help

this.msgConn.trigger();  
// Create listener object.  
var dgListener:Object = new Object();  
dgListener.cellPress = function(evt\_obj:Object) {

var contactCol = 0;  
var textCol = 1;

var rowIndex = evt\_obj.itemIndex;

\_global.contactName = evt\_obj.target.selectedItem.contactCol;  
\_global.msgContent = evt\_obj.target.selectedItem.textCol;

trace(\_global.contactName);  
trace(\_global.msgContent);  
};  
// Add listener.  
inbox\_dg.addEventListener(“cellPress”, dgListener);

Any help is much appreciated.  
Thanks  
Stew
