How can I customize a GridPanel column cell's content using server-side code? (OnDataBinding)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1

    How can I customize a GridPanel column cell's content using server-side code? (OnDataBinding)

    Hi guys, I have a gridpanel and there is a column that I implemented a custom renderer with a OnDataBinding event, how to implement a function that exposes the column value and content and allows me to read the current row values in order to customize this cell content?

    <ext:Column DataIndex="Printed" Header="Print" Width="50" >
       <Renderer OnDataBinding="RenderPrintColumn" AutoDataBind="true"/>
    </ext:Column>
    I need to read 3 different IDs from the SqlDataSource query that fills the GridPanel, stored on the <Reader> but not visible as columns in order to correctly place the cell's content.
    Thanks
    Last edited by geoffrey.mcgill; Jul 28, 2010 at 10:20 PM. Reason: please use [code] tags
  2. #2
    Hi paul-2011,

    Unfortunately I don't really understand what is required. Please provide more information re: the requirements.
    Geoffrey McGill
    Founder
  3. #3
    Quote Originally Posted by geoffrey.mcgill View Post
    Hi paul-2011,

    Unfortunately I don't really understand what is required. Please provide more information re: the requirements.
    Sure, the thing is, on this column I need to perform complex server side operations in order to decide what to render in there, so I will need access to a server side event when that cell is about to be data bounded and from there I will do the necessary operations, but in order to do do the operations I need to access not only the cell current value but the row ID as well, can you advise?
    Thanks
  4. #4
    Quote Originally Posted by paul-2011 View Post
    I will need access to a server side event when that cell is about to be data bounded and from there I will do the necessary operations
    no can do.

    This would need to be done client-side with a <Renderer> on the Column. The Renderer can perform logic based on the record value.

    If the value of a Data item is dependent on some server-side logic, that logic should be run server-side before the data is bound to the Store.

    Hope this helps.
    Geoffrey McGill
    Founder
  5. #5
    Quote Originally Posted by geoffrey.mcgill View Post
    no can do.

    This would need to be done client-side with a <Renderer> on the Column. The Renderer can perform logic based on the record value.

    If the value of a Data item is dependent on some server-side logic, that logic should be run server-side before the data is bound to the Store.

    Hope this helps.
    I understand but I'm looking for a simple functionality that standard ASP.NET controls always offered, I need to check the user's credential in order to render the cell with the correct values and add functionality or disable functionality, I can't do that on the client-side because of security issues, also, I'm binding the store to a SqlDataSource for speed, if I write the business logic when loading the data before binding to the store it will be slower, use more resources and generate more code to maintain, while with the "RowDataBound" event of most grid controls I can quickly enable or disabled functionality based on the user credentials and object ID, are you sure that there is no equivalente "RowDataBound" event for the GridPanel that can be run on server-side?
    Thanks

    Remember, I started like this:
    <ext:Column DataIndex="Printed" Header="Print" Width="50" >
       <Renderer OnDataBinding="RenderPrintColumn" AutoDataBind="true"/>
    </ext:Column>
    
    public void RenderPrintColumn(object sender, EventArgs e)
    {
      //how to query the cell value and row id from here and then change the cell contents?
    }
    Last edited by paul-2011; Jul 29, 2010 at 2:51 AM.
  6. #6
    No "simple" way to changing the cell during the row databinding event?

Similar Threads

  1. Replies: 0
    Last Post: May 10, 2012, 12:38 PM
  2. [CLOSED] Center GridPanel cell column content
    By deejayns in forum 1.x Legacy Premium Help
    Replies: 5
    Last Post: Apr 04, 2012, 10:24 AM
  3. Replies: 0
    Last Post: Jun 21, 2011, 2:51 AM
  4. Replies: 2
    Last Post: Apr 26, 2011, 6:50 PM
  5. GridPanel Cell Value at Server Side
    By Ganesh3.shirsath in forum 1.x Help
    Replies: 1
    Last Post: Sep 29, 2010, 3:01 PM

Posting Permissions