Grid panel - Get current Data Item (row) on DataBinding

Page 1 of 2 12 LastLast
  1. #1

    Grid panel - Get current Data Item (row) on DataBinding

    I need to setup each row in ext.net GridPanel on OnDataBinding event. How can I get current data item at server side?
    //aspx
    <uc:GridPanel ID="egrBills" runat="server" Border="false" Layout="Fit">
     <Store>
      <ext:Store runat="server" OnDataBinding="OnDataBinding_EventHandler" ID="MainStore">
       <!-- ............ -->
    
    //aspx.cs
    protected void OnDataBinding_EventHandler(object sender, EventArgs e)
    {
        //How do I get current data item?           
    }
  2. #2
    What exactly do you need to accomplish?
    GridPanel/Store uses diiferent approach then standard ASP.NET databound controls (mostly operations are performed on the client side, server side serializes data only)

    You can use DataSource property of a Store to get data
  3. #3
    Quote Originally Posted by Vladimir View Post
    What exactly do you need to accomplish?
    GridPanel/Store uses diiferent approach then standard ASP.NET databound controls (mostly operations are performed on the client side, server side serializes data only)

    You can use DataSource property of a Store to get data
    I want to display certain icon on every row which depends on Current Data Item. And I want to do it on only at the server side.
  4. #4
    You can add link to binded data (as seprate field for example) and use column renderer to render image (as html image tag)
  5. #5
    Will you show me an example?
  6. #6
    Quote Originally Posted by Vladimir View Post
    You can add link to binded data (as seprate field for example) and use column renderer to render image (as html image tag)
    at the server side, not on the client.
  7. #7
  8. #8
    Daniil, thanks!

    I still can't display an image inside a row.


    <script type="text/javascript">
         function renderActions (value, meta, record) {
            var image = "<img src='{0}' alt='{0}' />";
             
            if (value == 0) {
                alert('0');
                return String.format(image, hdnPayIcon.getValue());
            }
    
    
            if (value == 1) {
                alert('1');
                return String.format(image, hdnDeleteIcon.getValue());
            }
    
    
            if (value == 2) {
                alert('2');
                return String.format(image, hdnPayDisableIcon.getValue());
            }
    
    
    
            if (value == 3) {
                alert('3');
                return String.format(image, hdnDeleteDisableIcon.getValue());
            }
    
    
           
        }
    </script>
     <!----------------------------------- ------------------------>
                <ext:Column Header="Actions" DataIndex="Status">
                      <Renderer Fn="renderActions"></Renderer>
                </ext:Column>
            </Columns>
        </ColumnModel>
         
    <ext:Hidden runat="server" ID="hdnPayIcon" IDMode="Static" />
    <ext:Hidden runat="server" ID="hdnDeleteIcon" IDMode="Static" />
    <ext:Hidden runat="server" ID="hdnPayDisableIcon" IDMode="Static" />
    <ext:Hidden runat="server" ID="hdnDeleteDisableIcon" IDMode="Static" />
    
    
    
     protected void Page_Init(object sender, EventArgs e)
            {
                
                if (!Ext.Net.ExtNet.IsAjaxRequest)
                {
                    hdnPayIcon.Value = ResourceManager.GetInstance().GetIconUrl(Icon.MoneyAdd);
                    hdnDeleteIcon.Value = ResourceManager.GetInstance().GetIconUrl(Icon.MoneyDelete);
                    hdnPayIcon.Value = ResourceManager.GetInstance().GetIconUrl(Icon.PluginKey);
                    hdnPayIcon.Value = ResourceManager.GetInstance().GetIconUrl(Icon.PluginLink);
                }
            }
    The output html for image
    <img src="" alt="">

    for hidden
    <div id="hdnPayIcon_Container" style="display:inline;">
    <input type="hidden" size="20" autocomplete="off" id="hdnPayIcon" name="hdnPayIcon" class=" x-form-hidden x-form-field" value="/WebResource.axd?d=boiaeV6S42l81ETMaRMMrn96aUPYiiVKsC864r2u7LFIpsgSwoEUzjRjXRl8cVtDRYmE__od7XEPc1NWMflFw5S0Whe2yz93s_0vqoxgZgU02OeIOzBV4A7Po1VfoKZ5OzGHGatp1muPdAxYVx3egA2&amp;amp;t=634472712483198277"></div>
    Last edited by AlexMaslakov; Aug 10, 2011 at 7:32 AM.
  9. #9
    1. I see WebResource.axd is used in url. Did you add Ext.Net http handler and module to web.config? Or may be did you set CleanResourceUrl="false" to resource manager (false value forces webresource.axd urls)
    2. WebResource.axd url uses ampersand but that ampersand is encoded when you add that url to the hidden field
  10. #10
    Vladimir, I set ResourceManager.CleanResourceUrl to "false". It gets the same result.
    Is it not enough?
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 2
    Last Post: Dec 22, 2011, 2:45 PM
  2. ExtraParams get current item
    By luiz in forum 1.x Help
    Replies: 2
    Last Post: Apr 29, 2011, 11:41 AM
  3. Replies: 16
    Last Post: Feb 23, 2011, 10:03 AM
  4. Retieving Data from data base in the Grid Panel
    By Rakeshkumar.a in forum 1.x Help
    Replies: 0
    Last Post: Oct 13, 2010, 6:18 AM
  5. [CLOSED] Grouping doesn't group entire grid data...just current page.
    By rthiney in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Mar 05, 2010, 2:34 PM

Tags for this Thread

Posting Permissions