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

RadRate Events Firing

2 Answers 73 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Nikita Yaroshevsky
Top achievements
Rank 1
Nikita Yaroshevsky asked on 31 Jan 2011, 10:03 PM
Trying to get value from RadRate (which is created dynamically) in <itemTemplate>. Could somebody tell me what I'm doing wrong?

<telerik:RadGrid ID="RadGrid1" EnableViewState="False" OnPageIndexChanged="RadGrid1_PageIndexChanged"
                runat="server" DataSourceID="SqlDataSource1" GridLines="None" Width="850px" Height="100%"
                Skin="Telerik" PageSize="20" OnItemCreated="RadGrid1_ItemCreated" AllowPaging="True">
                <PagerStyle Mode="NumericPages" PageButtonCount="1" Position="TopAndBottom" />
                <MasterTableView BorderStyle="None" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" 
                    PageSize="20">
                    <NoRecordsTemplate>
                        <div>
                            Nothing was found, start your search again. To Refresh, click <a href="inventory.aspx?reset=no&make=clear&model=clear&yearFromGrid=clear">
                                here</a></div>
                    </NoRecordsTemplate>
                    <Columns>
                        <telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID" UniqueName="ID"
                            DataType="System.Int32" ReadOnly="True" Visible="False" AutoPostBackOnFilter="True">
                        </telerik:GridBoundColumn>
                    </Columns>
                    <ItemTemplate>
                                                                                <asp:UpdatePanel UpdateMode="Conditional" runat="server" ID="panel1"> 
                                                                                <Triggers>
                                                                                
                                                                                </Triggers>                                                                               
                                                                                <ContentTemplate>
                                                                                <telerik:RadRating ID="RadRating1" Value="3"  runat="server" ViewStateMode="Enabled" AutoPostBack="True"    />
                                                                                </ContentTemplate>
                                                                                <Triggers>
                                                                                <asp:AsyncPostBackTrigger ControlID="RadRating1" EventName="Rate" />                                                                                
                                                                                </Triggers>
                                                                                </asp:UpdatePanel>                      
                    </ItemTemplate>
                    <EditFormSettings>
                        <FormTemplate>
                        </FormTemplate>
                    </EditFormSettings>
                    <PagerStyle Mode="NumericPages" Position="TopAndBottom" />
                </MasterTableView>
                <ActiveItemStyle BorderStyle="None" />
            </telerik:RadGrid>
--------------------------------------------------------------------------------------------

    Public Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles RadGrid1.ItemCreated
        If e.Item.ItemType = GridItemType.AlternatingItem Or e.Item.ItemType = GridItemType.Item Then
            Dim item As Telerik.Web.UI.GridDataItem
            item = e.Item

            Dim radRate As Telerik.Web.UI.RadRating = item("ID").FindControl("RadRating1")

            Dim panel1 As UpdatePanel = item("ID").FindControl("panel1")

            AddHandler panel1.Load, AddressOf CControls_UnitGrid.up1_Load            
            AddHandler radRate.Rate, AddressOf CControls_UnitGrid.Rate

            Dim apt As New AsyncPostBackTrigger
            apt.ControlID = radRate.ID
            apt.EventName = "Rate"
            panel1.Triggers.Add(apt)

        End If
    End Sub

2 Answers, 1 is accepted

Sort by
0
Tsvetie
Telerik team
answered on 03 Feb 2011, 05:23 PM
Hello Nikita Yaroshevsky,
Please, either remove the UpdatePanel control from your ItemTemplate or replace it with RadAjaxPanel control. As soon as I did the latter, the page opened as expected and the Rate server handler was executed as expected, when I clicked on the rating control. I have attached my test page for your reference. In case it does not help you, please open a new support ticket and send me a running test project that demonstrates the problem you have.

Best wishes,
Tsvetie
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0
Nikita Yaroshevsky
Top achievements
Rank 1
answered on 03 Feb 2011, 10:37 PM
Yes it worked, I have taken it out of itemtemplate AND turned on the viewstate on the grid. Thanks for help!
Tags
Rating
Asked by
Nikita Yaroshevsky
Top achievements
Rank 1
Answers by
Tsvetie
Telerik team
Nikita Yaroshevsky
Top achievements
Rank 1
Share this question
or