View Full Version : [CLOSED] How to get ID of multiple rows selected from Grid using Selectionmodel

May 09, 2013, 5:06 AM
i have a gridpanel which contains a check box in front of every row and also on header.
if i select the check box on header it selects all below check box (or all rows in gridpanel )
now in code file it only returns me ID of first row.. but i need ID of all different rows availabe in gridpanel.

code aspx

<ext:GridPanel ID="GridPanel1" runat="server" Width="300" Layout="Fit" StoreID="JobStoreMapping"
Selectable="true" Height="200" AutoScroll="true">
<ext:Column ID="ColPosition" runat="server" DataIndex="posCode" Width="100" Text="POSITION"
Align="Center" />
<ext:Column ID="ColPosName" runat="server" DataIndex="posName" Width="200" Text="POSITION NAME"
Align="Center" />

<ext:CheckboxSelectionModel ID="CheckboxSelectionModel1" runat="server" Mode="Multi">
<Select OnEvent="Cell_Click" Buffer="100">
<ext:Parameter Name="jobMappIdPk" Value="record.data.pk_jobFamillMapp" Mode="Raw">
<ext:Parameter Name="jobMappId" Value="record.data.jobFamilyId" Mode="Raw">
<ext:Parameter Name="ShortDesc" Value="record.data.jfmlyShortDesc" Mode="Raw">
<ext:Parameter Name="PositionId" Value="record.data.fk_PositionId" Mode="Raw">


code behind

protected void Cell_Click(object sender, DirectEventArgs e)
// Function to respond when the user clicks on an entry in Job Family list on the Grid.

string jobMappIdPk = e.ExtraParams["jobMappIdPk"]; // get the row id of the Job Family selected from the grid. This rowid is same as the key for the
// Job Family Table.
Session["jobMappIdPk"] = jobMappIdPk; // Save this jobId. We need this information throughout the operation.
// Short Description of the Job
TAJobDesc.Text = e.ExtraParams["ShortDesc"]; // Long Description
// DDJobFamily1.Text = e.ExtraParams["PositionId"]; // Status: Active/Inactive/Draft
// Now that user selected a job family, we can enable the following buttons.
catch (Exception ex)
X.Msg.Alert("Status", ex.Message, new JFunction { Fn = "" }).Show();

i am using Session["jobMappIdPk"] in where clause to perform delete action in sql...
but unfortunately it store ID of nly first row..
plz help me ...

example query is:-

delete from tc_jobFamilyMapping where pk_jobFamillMapp = '" + Session["jobMappIdPk"]+ "'

May 09, 2013, 5:20 AM
Hi @Tonic,

Please use a selection model's SelectedRows property.

May 09, 2013, 6:16 AM
thanks ...! done....