Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
355
WebDataGrid - Problem getting selected cell value in javascript on CellSelectionchanged event
posted

I'm using the new V10.2 controls, Visual Studio 2008. I just need to get the row of the cell selected, then use that to get a value from the same row.  I have problems with both of those things - I have comment lines in ALL CAPS above my problem lines in the javascript.

Here's the source:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="Default.aspx.vb" Inherits="AdvancedHomeCare._Default" %>

<%@ Register Assembly="Infragistics35.Web.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7DD5C3163F2CD0CB"  Namespace="Infragistics.Web.UI.GridControls" TagPrefix="ig" %>

<%@ Register assembly="Infragistics35.WebUI.WebDataInput.v10.2, Version=10.2.20102.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.WebUI.WebDataInput" tagprefix="igtxt" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

    <title></title>

    <base target="_parent" />

    <script type="text/javascript" id="igClientScript">

<!--

function grdJobs_Selection_CellSelectionChanged(sender, eventArgs) {

    //get the grid

    grid = $find('grdJobs');

 

    //find the row selected

    //THE FOLLOWING LINE DOES NOT WORK

    var row = eventArgs.currentSelectedCells(0).Row.Index;

 

    //I NEED THE ROW, THEN THE VALUE OF THE COLUMN intJobId (column 9)

    //DON'T KNOW IF THIS IS CORRECT EITHER

    var job = grid.Rows(row).Items(9).Value;

 

    var url = 'jobdetails.aspx?id=' + job

    window.location = url;

}

// -->

</script>

 

</head>

<body>

    <form id="form1" runat="server" style="width: 241px">

    <div>

    </div>

    <asp:ScriptManager ID="ScriptManager1" runat="server">

    </asp:ScriptManager>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">

        <ContentTemplate>

            &nbsp;<ig:WebDataGrid ID="grdJobs" runat="server" Height="250px" StyleSetName="AHC" Width="240px"

                DataSourceID="dataJobs" AutoGenerateColumns="False" BorderStyle="None" BackColor="White"

                EnableAjax="False">

                <Behaviors>

                    <ig:Filtering Visibility="Hidden">

                    </ig:Filtering>

                    <ig:EditingCore AutoCRUD="False" Enabled="False">

                    </ig:EditingCore>

                    <ig:Activation Enabled="False">

                     <AutoPostBackFlags ActiveCellChanged="true" />

                    </ig:Activation>

                    <ig:Selection CellClickAction="Cell" RowSelectType="Single">

                        <AutoPostBackFlags CellSelectionChanged="true" />

                        <SelectionClientEvents CellSelectionChanged="grdJobs_Selection_CellSelectionChanged" />

                    </ig:Selection>

                </Behaviors>

 

                <Columns>

                    <ig:BoundDataField DataFieldName="Profession" Key="Profession" Width="38%">

                        <Header Text="Profession" />

                    </ig:BoundDataField>

                    <ig:BoundDataField DataFieldName="Skill" Hidden="True" Key="Skill">

                        <Header Text="BoundColumn_1" />

                    </ig:BoundDataField>

                    <ig:BoundDataField DataFieldName="Setting" Hidden="True" Key="Setting">

                        <Header Text="BoundColumn_2" />

                    </ig:BoundDataField>

                    <ig:BoundDataField DataFieldName="Shift" Hidden="True" Key="Shift">

                        <Header Text="BoundColumn_3" />

                    </ig:BoundDataField>

                    <ig:BoundDataField DataFieldName="Schedule" Hidden="True" Key="Schedule">

                        <Header Text="BoundColumn_0" />

                    </ig:BoundDataField>

                    <ig:BoundDataField DataFieldName="JobOpeningType" Hidden="True" Key="JobOpeningType">

                        <Header Text="BoundColumn_4" />

                    </ig:BoundDataField>

                    <ig:BoundDataField DataFieldName="City" Key="City" Width="40%">

                        <Header Text="City" />

                    </ig:BoundDataField>

                    <ig:BoundDataField DataFieldName="StateAbbrev" Key="StateAbbrev" Width="22%">

                        <Header Text="State" />

                    </ig:BoundDataField>

                    <ig:BoundDataField DataFieldName="Pay" Hidden="True" Key="Pay">

                        <Header Text="BoundColumn_7" />

                    </ig:BoundDataField>

                    <ig:BoundDataField DataFieldName="intJobId" Hidden="True" Key="intJobId">

                        <Header Text="BoundColumn_1" />

                    </ig:BoundDataField>

                </Columns>

            </ig:WebDataGrid>

            <asp:SqlDataSource ID="dataJobs" runat="server" ConnectionString="<%$ ConnectionStrings:AlexisConnectionString %>"

                SelectCommand="usp_JobBoard_GetJobs" SelectCommandType="StoredProcedure" EnableCaching="True"

                CacheDuration="Infinite">

                <SelectParameters>

                    <asp:SessionParameter DefaultValue="** Not Selected **" Name="Profession" SessionField="Profession" />

                    <asp:SessionParameter DefaultValue="'**'" Name="State" SessionField="StateAbbrev" />

                    <asp:SessionParameter DefaultValue="'** Not Selected **'" Name="JobType" SessionField="JobOpeningType" />

                    <asp:SessionParameter DefaultValue="'** Not Selected **'" Name="Setting" SessionField="Setting" />

                    <asp:Parameter DefaultValue="0" Name="JobRanking" Type="Int32" />

                    <asp:SessionParameter DefaultValue="1" Name="PageNumber" SessionField="pageCurrent"

                        Type="Int32" />

                    <asp:Parameter DefaultValue="4" Name="JobsPerPage" Type="Int32" />

                    <asp:SessionParameter DefaultValue="Pay" Name="SortBy" SessionField="SortBy" Type="String" />

                    <asp:Parameter DefaultValue="4" Name="OverrideType" Type="Int32" />

                </SelectParameters>

            </asp:SqlDataSource>

        </ContentTemplate>

    </asp:UpdatePanel>

    </form>

</body>

</html>