This is a migrated thread and some comments may be shown as answers.

Adding Highlight Effect When New Row Is Added

1 Answer 103 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Phil
Top achievements
Rank 1
Phil asked on 09 Jul 2008, 09:53 PM
I'm trying to add a highlight effect to newly added rows in the radgrid.  I have a timer that will all me to rebind the radgrid to my datasource but I am unable to determine which row has been added to the grid so I will be able to call my highlight effect.

The code below will display for all rows whenever the timer fires.  Is there a way to attach my highlight effect only on newly added rows instead of everything already in the grid too?
    <script src="/scripts/prototype.js" type="text/javascript"></script> 
    <script src="/scripts/scriptaculous.js" type="text/javascript"></script> 
    <script type="text/javascript"
        function RowCreated(sender, eventArgs) 
        { 
            new Effect.Highlight(eventArgs.get_gridDataItem().get_element(),  
                      { 
                        startcolor: "#ffff99", 
                        endcolor: eventArgs.get_gridDataItem().get_element().style.backgroundColor, 
                        duration: 8 
                      })             
        } 
    </script> 
 
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server"
    </telerik:RadScriptManager> 
    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"
        <telerik:RadGrid ID="RadGrid1" runat="server" Width="100%" DataSourceID="LinqDataSource1" 
            GridLines="None" Skin="Telerik"
            <MasterTableView AutoGenerateColumns="False" DataKeyNames="RequestId" DataSourceID="LinqDataSource1"
                <RowIndicatorColumn Visible="False"
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </RowIndicatorColumn> 
                <ExpandCollapseColumn Visible="False" Resizable="False"
                    <HeaderStyle Width="20px"></HeaderStyle> 
                </ExpandCollapseColumn> 
                <Columns> 
                    <telerik:GridBoundColumn DataField="RequestId" DataType="System.Decimal" HeaderText="RequestId" 
                        ReadOnly="True" SortExpression="RequestId" UniqueName="RequestId"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="FirstName" HeaderText="FirstName" SortExpression="FirstName" 
                        UniqueName="FirstName"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="LastName" HeaderText="LastName" SortExpression="LastName" 
                        UniqueName="LastName"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="DateOfBirth" DataType="System.DateTime" HeaderText="DateOfBirth" 
                        SortExpression="DateOfBirth" UniqueName="DateOfBirth"
                    </telerik:GridBoundColumn> 
                    <telerik:GridBoundColumn DataField="CreatedDate" DataType="System.DateTime" HeaderText="CreatedDate" 
                        SortExpression="CreatedDate" UniqueName="CreatedDate"
                    </telerik:GridBoundColumn> 
                </Columns> 
                <EditFormSettings> 
                    <PopUpSettings ScrollBars="None"></PopUpSettings> 
                </EditFormSettings> 
            </MasterTableView> 
            <ClientSettings> 
                <ClientEvents OnRowCreated="RowCreated" /> 
            </ClientSettings> 
        </telerik:RadGrid> 
        <asp:LinqDataSource ID="LinqDataSource1" runat="server" ContextTypeName="MyDataContext" 
            TableName="MyTable" OrderBy="CreatedDate desc"
        </asp:LinqDataSource> 
        <asp:Timer ID="Timer1" runat="server" Interval="15000" OnTick="Timer1_Tick"
        </asp:Timer> 
    </telerik:RadAjaxPanel> 
 

1 Answer, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 10 Jul 2008, 05:32 AM
Hi Phil,

Here is a code library submission which explains how to select the last inserted row in Grid.
Select Last Inserted Row

Thanks
Princy.
Tags
Grid
Asked by
Phil
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Share this question
or