GridPanel RecordID returns -1 when JsonReader IDProperty set to GUID?

  1. #1

    GridPanel RecordID returns -1 when JsonReader IDProperty set to GUID?

    Good morning,

    a quick question (I am sure there is an easy answer ...). In the following code, the store's IDProperty is set to "ProviderUserKey" which correctly contains the GUID but gridpanel's RowSelectionModel1.SelectedRow.RecordID is always "-1" instead of the GUID value. Why, what am I missing?

       <ext:Store 
            ID="Store1" 
            runat="server" 
            OnRefreshData="Store1_RefreshData">
            <Proxy>
                <ext:PageProxy />
            </Proxy>
            <Reader>
                <ext:JsonReader IDProperty="ProviderUserKey">
                    <Fields>
                        <ext:RecordField Name="UserName" />
                        <ext:RecordField Name="LastLoginDate" Type="Date" />
                        <ext:RecordField Name="CreationDate" Type="Date" />
                        <ext:RecordField Name="IsApproved" Type="Boolean" />
                    </Fields>
                </ext:JsonReader>
            </Reader>            
        </ext:Store>
    
       <ext:GridPanel 
            ID="GridPanel1" 
            runat="server"
            Height="400"
            AutoWidth="true"
            StoreID="Store1"
            AutoExpandColumn="UserName">
            <ColumnModel>
                <Columns>
                    <ext:Column Header="Όνομα Χρήστη" Width="50" DataIndex="UserName" />                    
                    <ext:DateColumn Header="Δημιουργήθηκε" Width="150" DataIndex="CreationDate" Format="dd/MM/yyyy HH:mm" />
                    <ext:DateColumn Header="Τελευτ. Είσοδος" Width="150" DataIndex="LastLoginDate" Format="dd/MM/yyyy HH:mm" />                
                    <ext:CheckColumn Header="Ενεργός" Align="Center" Width="80" DataIndex="IsApproved" Editable="true" />
                </Columns>
            </ColumnModel>
            <SelectionModel>
                <ext:RowSelectionModel ID="RowSelectionModel1" runat="server" SingleSelect="true">
                    <DirectEvents>
                        <RowSelect OnEvent="GridPanel1_RowSelect">
                        </RowSelect>                    
                    </DirectEvents>
                </ext:RowSelectionModel>
            </SelectionModel>            
        </ext:GridPanel>
    Code behind:

           protected void Store1_RefreshData(object sender, StoreRefreshDataEventArgs e)
            {
                this.Store1.DataSource = Membership.GetAllUsers();    // returns ASP.NET's MemberhipUserCollection
                this.Store1.DataBind();
            }
    
           protected void GridPanel1_RowSelect(object sender, DirectEventArgs e)
            {
                    Guid guid = new Guid(RowSelectionModel1.SelectedRow.RecordID);  // FAILS
            }
    Thank you
  2. #2

    version 2 sample

    Just to let you know the same thing happens to ext.net 2; here's a small working sample:

    <%@ Page Language="C#" %>
    
    <%@ Register assembly="Ext.Net" namespace="Ext.Net" tagprefix="ext" %>
    
    <script runat="server">
        protected void Store1_ReadData(object sender, StoreReadDataEventArgs e)
        {
            Store1.DataSource = Membership.GetAllUsers();
            Store1.DataBind();
        }
    
        protected void GridPanel1_Select(object sender, DirectEventArgs e)
        {
            X.Msg.Notify("", "Record " + RowSelectionModel1.SelectedRow.RecordID).Show();
        }
    </script>
    
    <!DOCTYPE html>
    
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
        <title></title>
    </head>
    <body>
        <form id="form1" runat="server">
        <div>
            <ext:ResourceManager ID="ResourceManager1" runat="server"/>        
            <ext:Store ID="Store1"
                runat="server"
                OnReadData="Store1_ReadData">
                <Proxy>
                    <ext:PageProxy />
                </Proxy>
                <Model>
                    <ext:Model runat="server" IDProperty="ProviderUserKey">
                        <Fields>
                            <ext:ModelField Name="UserName" />
                            <ext:ModelField Name="LastLoginDate" Type="Date" />
                        </Fields>
                    </ext:Model>
                </Model>
            </ext:Store>
            <ext:GridPanel ID="GridPanel1"
                runat="server"
                Frame="true"
                Title="Users"
                Height="200"
                StoreID="Store1">
                <ColumnModel>
                    <Columns>
                        <ext:Column runat="server" Text="Username" DataIndex="UserName" />
                        <ext:Column runat="server" Text="Last Login" DataIndex="LastLoginDate"/>
                    </Columns>
                </ColumnModel>    
                <SelectionModel>
                    <ext:RowSelectionModel ID="RowSelectionModel1" runat="server">
                        <DirectEvents>
                            <Select OnEvent="GridPanel1_Select" />
                        </DirectEvents>
                    </ext:RowSelectionModel>
                </SelectionModel>
            </ext:GridPanel>
        </div>
        </form>
    </body>
    </html>
    FYI, ProviderUserKey is GUID. RecordID does not contain the GUID value. Please let me know if you are not familiar with the System.Web.Security.MembershipUser class.

    I wonder if this is a bug.

Similar Threads

  1. Replies: 1
    Last Post: Jun 26, 2013, 4:00 PM
  2. Replies: 0
    Last Post: May 16, 2012, 5:35 PM
  3. Replies: 6
    Last Post: Dec 27, 2011, 9:47 AM
  4. Replies: 1
    Last Post: Jun 08, 2011, 4:11 AM
  5. [CLOSED] RecordID in GridPanel
    By Jurke in forum 1.x Premium Help
    Replies: 2
    Last Post: Oct 08, 2008, 10:02 AM

Tags for this Thread

Posting Permissions