Developing Matt

My Technical Journal

HOW TO GET VALUE FROM SELECTED CELL IN WEBDATAGRID

leave a comment »

This information relates to infragistic’s webdatagrid (11.1) so disregard if you don’t use it. I’m putting it here so I can reference it later.  There are a few different ways to get data from the grid.  I’ve struggled through them, so here they are:

 

1.

on double click event you can use event args…

eventArgs.get_item().get_row().get_cellByColumnKey("column_name").get_text()

2.

You can reference the grid also with the sender argument if it is used in an event

sender.get_behaviors().get_selection().get_selectedRows(0).getItem(0).get_cellByColumnKey("columnname").get_text()

3.

You can just reference the grid directly

var grid = ig_controls["gridName"];

var value = grid.get_behaviors().get_selection().get_selectedRows(0).getItem(0).get_cellByColumnKey("column_name").get_text()

4.

if you are using a link inside the grid you can also just send the data you need with

function gotolink(jvalue) {
    window.open("page.aspx?querystring=" + value, ‘_blank’);
    return false;
}

<ig:TemplateDataField Key="joblink" Header-Text="Job" Width="35px">
                       <ItemTemplate>
                           <a href="#" onclick=’javascript: return gotolink(<%# DataBinder.Eval(DirectCast(Container, Infragistics.Web.UI.TemplateContainer).DataItem, "columnnametosend") %>);’>
                               <%# DataBinder.Eval(DirectCast(Container, Infragistics.Web.UI.TemplateContainer).DataItem, "columnnametoshow") %>
                           </a>
                      </ItemTemplate>
         <Header Text="Job" />
</ig:TemplateDataField>

Advertisements

Written by matt

August 23, 2011 at 3:59 pm

Posted in Asp.net

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: