RadRate Events Firing

3 posts, 0 answers
  1. Nikita Yaroshevsky
    Nikita Yaroshevsky avatar
    21 posts
    Member since:
    Apr 2010

    Posted 31 Jan 2011 Link to this post

    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. Tsvetie
    Admin
    Tsvetie avatar
    1517 posts

    Posted 03 Feb 2011 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Nikita Yaroshevsky
    Nikita Yaroshevsky avatar
    21 posts
    Member since:
    Apr 2010

    Posted 03 Feb 2011 Link to this post

    Yes it worked, I have taken it out of itemtemplate AND turned on the viewstate on the grid. Thanks for help!
Back to Top