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
25
Gird Seleted Items Values
posted

Hi

I working on UltraWebGird

My Requirement is I can select Multipule cells (that contains 'Int' Values) on the grid

I need the all the selected values to collect in variable to sum(Addition) ,

And I have to display the same in TooTip.

I am unable to get the selected cell values

Plz help me

Thanks in Advance

My code is like this

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

<%

 

@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="GridToolTipTry._Default"

%>

 

<%

@ Register assembly="Infragistics35.Web.v8.3, Version=8.3.20083.1009, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.GridControls" tagprefix="ig"

%>

<!

 

 

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

>

</

 

 

head

>

<

 

 

script type

="text/javascript">

function

 

 

WebDataDrid1_PageIndexChanging() {

GetGridSelectedRows(

 

"<%= this.WebDataGrid1.ClientID %>"

);

}

 

 

 

function

 

 

GetGridSelectedRows(gridname) {

 

 

var

grid = $find(gridname);

 

 

var

behav = grid.get_behaviors();

 

 

var

selection = behav.get_selection();

 

 

var

pageindex = behav.get_paging().get_pageIndex();

 

 

var

selectedRows = selection.get_selectedRows();

 

 

var strSelection = ""

;

hidSelections = document.getElementById(

 

"hidSelections"

);

 

 

for

(i = 0; i < selectedRows.get_length(); i++) {

 

 

var item = pageindex + "_" + selectedRows.getItem(i).get_index() + "|"

;

 

 

if

(hidSelections.value.indexOf(item) < 0) {

strSelection += item;

}

}

hidSelections.value = hidSelections.value + strSelection;

}

 

 

</

 

 

script

>

<

 

 

body

>

 

 

<form id="form1" runat

="server">

 

 

 

 

<div

>

 

 

 

 

 

<asp:SqlDataSource ID="GridDataSsource" runat="server"

 

 

ConnectionString="<%$ ConnectionStrings:ULTIMATE_NEWConnectionString %>"

 

 

SelectCommand

="SELECT ID, ID AS Expr1, ID AS Expr2, ID AS Expr3 FROM Customer">

 

 

</asp:SqlDataSource

>

 

 

 

<br

/>

 

 

 

</div

>

 

 

<asp:HiddenField ID="hidSelections" runat="server"

/>

 

 

<ig:WebDataGrid ID="WebDataGrid1" runat="server" AutoGenerateColumns="False"

 

 

DataSourceID="GridDataSsource" Height="424px" Width="1063px" DataKeyFields

="ID">

 

 

<Behaviors

>

 

 

<ig:Selection CellSelectType

="Multiple">

 

 

</ig:Selection

>

 

 

<ig:EditingCore AutoCRUD

="False">

 

 

</ig:EditingCore

>

 

 

<ig:RowSelectors

>

 

 

</ig:RowSelectors

>

 

 

<ig:Paging

>

 

 

<

PagingClientEvents

 

 

PageIndexChanging

="WebDataDrid1_PageIndexChanging"

 

 

/>

 

 

</ig:Paging

>

 

 

<ig:Activation

>

 

 

</ig:Activation

>

 

 

</Behaviors

>

 

 

<Columns

>

 

 

<ig:BoundDataField DataFieldName="ID" Key

="ID">

 

 

<Header Text="ID"

/>

 

 

</ig:BoundDataField

>

 

 

<ig:BoundDataField DataFieldName="Expr1" Key

="Expr1">

 

 

<Header Text="Expr1"

/>

 

 

</ig:BoundDataField

>

 

 

<ig:BoundDataField DataFieldName="Expr2" Key

="Expr2">

 

 

<Header Text="Expr2"

/>

 

 

</ig:BoundDataField

>

 

 

<ig:BoundDataField DataFieldName="Expr3" Key

="Expr3">

 

 

<Header Text="Expr3"

/>

 

 

</ig:BoundDataField

>

 

 

</Columns

>

 

 

</ig:WebDataGrid

>

 

 

<asp:Label ID="Label1" runat="server"

 

 

style="z-index: 1; left: 47px; top: 660px; position: absolute; height: 44px; width: 373px"

 

 

Text="Label"></asp:Label

>

 

 

<asp:Button ID="Button1" runat="server" onclick="Button1_Click"

 

 

style="z-index: 1; left: 10px; top: 583px; position: absolute; height: 73px; width: 211px"

 

 

Text="Button"

/>

 

 

</form

>

</

 

 

body

>

</

 

 

html

>

Parents
No Data
Reply
  • 28464
    posted

    Hello,

    You can enumerate all cells in the grid with javascript and use the CSOM (client-side object model) function getValue to obtain the value from it. A cell can be reached with something similar to the following javascript

    var grid = igtbl_getGridById(gridname);
    var row = grid.getRow(0); // first row in the root band
    var cell = row.getCell(3); // fourth cell in the row
    var cellval = cell.getValue();

    You can get the selected status of a cell on the client side using the getSelected function. More information can be found in the online documented, in the Cell client-side object model docs here:

    http://help.infragistics.com/Help/NetAdvantage/NET/2008.3/CLR2.0/html/WebGrid_cell_Object_CSOM.html

Children
No Data