[CLOSED] Get selected record data from a dataview

  1. #1

    [CLOSED] Get selected record data from a dataview

    Hi,
    I'm following an example about the dataview, but I can't figure out about how to get the selected record data server side.

    <%@ Page Language="C#" AutoEventWireup="true"
        Inherits="InventoryProcess_INV_AnagraphicMaster" MasterPageFile="~/DefaultNavigation.master"
        Culture="auto" UICulture="auto" meta:resourcekey="PageResourcePic" MaintainScrollPositionOnPostback="true" Codebehind="INV_AnagraphicMaster.aspx.cs" %>
    
    
    
    
    <asp:Content ID="Content1" runat="server" ContentPlaceHolderID="CPH_HEAD">
            <link href="Inventory.css" rel="stylesheet" />
    </asp:Content>
    
    
    <asp:Content ID="Cnt" runat="server" ContentPlaceHolderID="ContentTop">  
        <div>
            <ext:Window ID="wndAccordion" 
            runat="server" 
            Title="Selezione oggetto"
            BodyBorder="0"
            Icon="ApplicationTileVertical"
            Layout="Accordion"
            Width="600">
            <Items>
    
    
                <ext:Panel ID="pnlPresidio" Title="Selezione Presidio" runat="server">
                    <Items>
          <ext:DataView ID="dvPresidi" runat="server" SingleSelect="true" 
              AutoShow="true"
                  Cls="img-chooser-view"
        OverItemCls="x-view-over"
        ItemSelector="div.thumb-wrap">
            <Store>
                <ext:Store ID="stPresidi" runat="server">        
                    <Model>
                        <ext:Model ID="mdlPresidi" runat="server">
                            <Fields>
                                <ext:ModelField Name="ID_INV2_LOCATION" Type="Int" />
                                <ext:ModelField Name="ID_INV2_LOCATION_PARENT" Type="Int" />
                                <ext:ModelField Name="ID_INV2_WARD" Type="Int" />
                                <ext:ModelField Name="WardName" Type="String" />
                                <ext:ModelField Name="ID_INV2_LOCATION_TYPE" Type="Int" />
                                <ext:ModelField Name="LocationType" Type="String" />
                                <ext:ModelField Name="LocationTypeImage" Type="String" />
                                <ext:ModelField Name="Name" Type="String" />
                                <ext:ModelField Name="Description" Type="String" />
                            </Fields>
                        </ext:Model>
                    </Model>
                </ext:Store>      
            </Store>
            <Tpl>
            <Html>
                <tpl for=".">
                    <div class="thumb-wrap">
                        <div class="thumb">
                            <tpl if="!Ext.isIE6">
                                <img style="width:100px;height:100px;" src="../Images/Inventory/{LocationTypeImage}" />
                            </tpl>
                            <tpl if="Ext.isIE6">
                                <div style="width:100px;height:100px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src="../Images/Inventory/{LocationTypeImage}")"></div>
                            </tpl>                    
                        </div>
                        <span>{Name}</span>
                    </div>
                </tpl>
            </Html>
        </Tpl>
         </ext:DataView>
                    </Items>
                    <BottomBar>
                        <ext:Toolbar runat="server" >
                            <Items>
                                <ext:ToolbarFill runat="server" />
                                <ext:Button runat="server" ID="btnSelezionePresidio" Text="Avanti">
                                    <DirectEvents>
                                        <Click OnEvent="btnSelezionePresidio_Click" />
                                    </DirectEvents>
                                </ext:Button>
                            </Items>
                        </ext:Toolbar>
                    </BottomBar>
                </ext:Panel>
    
    
                <ext:Panel ID="pnlEdificioCentrale" runat="server">
                    <Items>
    
    
    
    
                    </Items>
                </ext:Panel>
    
    
            </Items>
            </ext:Window>
        </div>
    </asp:Content>
    Server side code, in which I need to get the selected record data..

    protected void Page_Load(object sender, EventArgs e)
        {
            this.stPresidi.DataSource = AnagraphicMasterCore.GetPresidi(1);
        }
    
    
        protected void btnSelezionePresidio_Click(object sender, DirectEventArgs e)
        {
            int selected_ID;
            foreach (SelectedRow row in dvPresidi.SelectedRows)
            {
                selected_ID = stPresidi.GetAt(Convert.ToInt32(row.RowIndex)).??????
            }
        }
    Thanks for your help.

    Have a good day.
    Last edited by Daniil; Feb 07, 2014 at 7:00 AM. Reason: [CLOSED]
  2. #2
    Hi @John_Writers,

    Do you need all the record's fields? If so, they are not submitted automatically. Only selected records' ids and indexes are submitted automatically.

    You have to send it manually, please see the "Submit selected with values" button.
    https://examples2.ext.net/#/DataView/Basic/Overview/
  3. #3
    Ok,
    thank you for your time.

Similar Threads

  1. [CLOSED] How to set default selected item for dataview?
    By jchau in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 24, 2012, 12:00 PM
  2. Replies: 0
    Last Post: Nov 20, 2012, 1:08 PM
  3. Replies: 0
    Last Post: Sep 11, 2012, 8:33 AM
  4. [CLOSED] DataView Template unable to read the store Record Field
    By farisqadadeh in forum 1.x Legacy Premium Help
    Replies: 2
    Last Post: Dec 20, 2010, 3:23 PM
  5. Replies: 0
    Last Post: Feb 23, 2009, 7:28 PM

Posting Permissions