PDA

View Full Version : [CLOSED] Server side row click of grid panel row



otouri
Dec 17, 2012, 2:48 PM
I need your help i can't figure ou how to display the values of a row on a click event. i tried the different samples in EXT.NET but I can only get it to work for cell not a row.

The requirement: on row select(click): display on the table below with the the cells values corresonding to that row.

with the code below i can only get the value of the selected (clicked) cell.

Below is the sample code:

ASPX page:


<table>
<tr>
<td>
&nbsp;
</td>
<td colspan="8">
<ext:GridPanel ID="gpdealHLname" runat="server" Title="Result" Width="863">
<Store>
<ext:Store ID="gpdealHLnamestore" runat="server" OnReadData="MyData_Refresh" PageSize="5"
RemoteSort="true">
<Model>
<ext:Model ID="Model1" runat="server" IDProperty="AVID">
<Fields>
<ext:ModelField Name="AVID" Type="string" />
<ext:ModelField Name="Value" Type="String" />
<ext:ModelField Name="AVType" Type="String" />
<ext:ModelField Name="ActiveStatus" Type="Boolean" />
</Fields>
</ext:Model>
</Model>
<Sorters>
<ext:DataSorter Property="Value" Direction="ASC" />
</Sorters>
</ext:Store>
</Store>
<ColumnModel ID="ColumnModel1" runat="server">
<Columns>
<ext:Column ID="NumberColumn1" runat="server" Text="HLName ID" Visible="false" DataIndex="AVID" />
<ext:Column ID="Column1" runat="server" Text="HL Name" Align="Center" DataIndex="Value"
Width="287px" />
<ext:Column ID="Column2" runat="server" Text="Category" Align="Center" DataIndex="AVType"
Width="287px" />
<ext:CheckColumn ID="checknox1" runat="server" Text="Active Status" Align="Center"
DataIndex="ActiveStatus" Enabled="false" Width="287px" />
</Columns>
</ColumnModel>
<SelectionModel>
<ext:CellSelectionModel ID="CellSelectionModel1" runat="server" Mode="Single">
<DirectEvents>
<Select OnEvent="HLName_Click" />
</DirectEvents>
</ext:CellSelectionModel>
</SelectionModel>
<View>
<ext:GridView ID="gvdealHLname" runat="server" StripeRows="true">
</ext:GridView>
</View>
<BottomBar>
<ext:PagingToolbar ID="ptbgvdealHLname" runat="server">
<Items>
<ext:Label ID="Label1" runat="server" Text="Page size:" />
<ext:ToolbarSpacer ID="ToolbarSpacer1" runat="server" Width="10" />
<ext:ComboBox ID="ComboBox1" runat="server" Width="80">
<Items>
<ext:ListItem Text="1" />
<ext:ListItem Text="5" />
<ext:ListItem Text="10" />
<ext:ListItem Text="20" />
</Items>
<SelectedItems>
<ext:ListItem Value="5" />
</SelectedItems>
<Listeners>
<Select Handler="#{gpdealHLname}.store.pageSize = parseInt(this.getValue(), 10); #{gpdealHLname}.store.load();" />
</Listeners>
</ext:ComboBox>
</Items>
<Plugins>
<ext:ProgressBarPager ID="ProgressBarPager1" runat="server" />
</Plugins>
</ext:PagingToolbar>
</BottomBar>
</ext:GridPanel>
</td>
</tr>
</table>

<table>
<tr>
<td>
&nbsp;
</td>
</tr>
</table>
<table style="width: 60%; vertical-align: top; background-color: #FFFFFF; border: 1px solid #8BB7E3;"
cellpadding="5" cellspacing="0">
<tr>
<td colspan="4" valign="top" class="subFormHeader">
Add New HL Name
</td>
</tr>
<tr>
<td class="rfvCSS" colspan="4">
<asp:Label runat="server" ID="lblHLNameError" CssClass="rfvCSS2" Text="" />
</td>
</tr>
<tr>
<td colspan="4">
&nbsp;
</td>
</tr>

<tr>
<td style="width: 10px;">
&nbsp;
</td>
<td class="leftTableColumn" style="width: 200px;">
<asp:Label runat="server" ID="lblHLName" CssClass="requiredLabel" Text="HL Name:" />
</td>
<td>
<ext:TextField Cls="formTextbox" ID="txtHLName" runat="server" />
<asp:RequiredFieldValidator ID="rfHLName" ControlToValidate="txtHLName" runat="server"
Enabled="true" ValidationGroup="HLNameData">
</asp:RequiredFieldValidator>
</td>
<td>
&nbsp;
</td>
</tr>
<tr>
<td colspan="4">
&nbsp;
</td>
</tr>
<tr>
<td style="width: 20px;">
&nbsp;
</td>
<td>
<ext:RadioGroup ID="rdCategory" runat="server" Vertical="true" Width="200px">
<Items>
<ext:Radio ID="rdteam" runat="server" BoxLabel="Deal Team" Checked="true" ColumnWidth="0.20">
</ext:Radio>
<ext:Radio ID="rdsource" runat="server" BoxLabel="Source Person" ColumnWidth="0.75">
</ext:Radio>
</Items>
</ext:RadioGroup>
</td>
<td colspan="2">
&nbsp;
</td>
</tr>

<tr>
<td colspan="4">
&nbsp;
</td>
</tr>
<tr>
<td style="width: 20px;">
&nbsp;
</td>
<td>
<ext:Checkbox ID="chkstatus" runat="server" BoxLabel="Active Status"></ext:Checkbox>
</td>
<td colspan="2">
&nbsp;
</td>
</tr>
<tr>
<td colspan="4">
&nbsp;
</td>
</tr>
<tr>
<td colspan="4">
&nbsp;
</td>
</tr>
<tr>
<td colspan="4" align="center">
<table>
<tr>
<td>
<ext:Button ID="btnSaveHLName" runat="server" Icon="Disk" Cls="formButtonExt2" Text="Save"
Height="25" Width="70">
<DirectEvents>
<Click OnEvent="btnSaveHLName_Click" />
</DirectEvents>
</ext:Button>
</td>
<td style="width: 20px;">
&nbsp;
</td>
<td>
<ext:Button ID="btnCancelHLName" runat="server" Icon="Cancel" Cls="formButtonExt2"
Text="Cancel" Height="25" Width="70">
<DirectEvents>
<Click OnEvent="btnCancelHLName_Click" />
</DirectEvents>
</ext:Button>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="4">
&nbsp;
</td>
</tr>
</table>


below is code behind:


protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
this.gpdealHLnamestore.DataSource = new object[]
{
new object[] { "35", "User 1", "Deal Team", true },
new object[] { "68", "User 2", "Source Person", False },
new object[] { "322", "User 3", "Deal Team", true },
new object[] { "15", "User 4", "Source Person", true },
new object[] { "5", "User 5", "Deal Team", true }
};

this.gpdealHLnamestore.DataBind();
}
}

protected void HLName_Click(object sender, EventArgs e)
{

CellSelectionModel sm = this.gpdealHLname.GetSelectionModel() as CellSelectionModel;

this.txtHLName.Text = sm.SelectedCell.Value;

Session["HLnameid"] = sm.SelectedCell.RecordID;

}


Thank you

Vladimir
Dec 17, 2012, 3:17 PM
Please see the following sample
http://examples2.ext.net/#/GridPanel/Selection_Models/Submitting_Values/

otouri
Dec 17, 2012, 4:00 PM
Please see the following sample
http://examples2.ext.net/#/GridPanel/Selection_Models/Submitting_Values/

Thank you, That worked you may close the thread