How to Value Rating

16 posts, 0 answers
  1. Mohamad
    Mohamad avatar
    15 posts
    Member since:
    Feb 2012

    Posted 23 Feb 2012 Link to this post

    <asp:GridView ID="GridView1" runat="server"  DataKeyNames="TopicID"
            AutoGenerateColumns="False" ShowHeader="False" BorderStyle="None"
            GridLines="None" Width="100%" onrowcommand="GridView1_RowCommand">
    <Columns>
    <asp:TemplateField>
    <ItemTemplate>
    <telerik:radrating ID="RadRating1" Runat="server" Skin="Outlook"
    SelectionMode="Single" ItemCount="5"  OnClientRating="OnClientRating" />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
        </asp:GridView>


    What form of access to resources
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 23 Feb 2012 Link to this post

    Hello Mohamad,

    I suppose you want to access the controls in GridView. Here is the sample code.
    C#:
    protected void Button1_Click(object sender, EventArgs e)
    {
      foreach (GridViewRow row in GridView1.Rows)
      {
        RadRating ratg = (RadRating)row.FindControl("RadRating1");
      }
    }

    -Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Mohamad
    Mohamad avatar
    15 posts
    Member since:
    Feb 2012

    Posted 24 Feb 2012 Link to this post

    tanks.
    Like from the
    GridView1
    As
    postbak
    save to database
    value for codbegin
    no for Button1
  5. Mohamad
    Mohamad avatar
    15 posts
    Member since:
    Feb 2012

    Posted 24 Feb 2012 Link to this post

    help me.
    rate value for template gird
    on postbak save to database
  6. Mohamad
    Mohamad avatar
    15 posts
    Member since:
    Feb 2012

    Posted 26 Feb 2012 Link to this post

    How do I correct this code?


    <asp:GridView ID="GridView1" runat="server"
            AutoGenerateColumns="False" ShowHeader="False" BorderStyle="None"
            GridLines="None" Width="100%" onrowcommand="GridView1_RowCommand">
    <Columns>
    <asp:TemplateField>
    <ItemTemplate>
    <asp:Button ID="Button1" runat="server" CommandArgument='<%# Eval("TopicID")%>' CommandName="Clik" Text="oki" />
    <telerik:RadRating ID="RadRating1" Runat="server" SelectionMode="Single" Skin="Windows7" />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    ---------------
       public static string id;

        protected void tet(object sender, EventArgs e)
        {
            
            foreach (GridViewRow rw in GridView1.Rows)
            {
                RadRating r = (RadRating)rw.FindControl("RadRating1");
                id = r.Value.ToString();
            }

            Response.Write(id);

        }

        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {

            if (e.CommandName == "Clik")
            {
                tet(null, null);
            }
        }
  7. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 28 Feb 2012 Link to this post

    Hello Mohamad,

    The online demo Rating / RadRating in RadGrid shows a scenario, similar to the one you want to implement. I would suggest using it as a reference for implementing the desired functionality into your actual project.

    All the best,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  8. Mohamad
    Mohamad avatar
    15 posts
    Member since:
    Feb 2012

    Posted 28 Feb 2012 Link to this post

    I in the form template GridView1
    I use
    ----------
  9. Mohamad
    Mohamad avatar
    15 posts
    Member since:
    Feb 2012

    Posted 29 Feb 2012 Link to this post

    tanks admin.
    see
    <asp:GridView ID="GridView1" runat="server"  DataKeyNames="TopicID"
            AutoGenerateColumns="False" ShowHeader="False" BorderStyle="None"
            GridLines="None" Width="100%" onrowcommand="GridView1_RowCommand">
    <Columns>
    <asp:TemplateField>
    <ItemTemplate>
    <telerik:radrating ID="RadRating1" OnRate="RadRating1_Rate" AutoPostBack="True" Runat="server" Skin="Forest" Orientation="Horizontal"  SelectionMode="Single" ItemCount="5" />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
        </asp:GridView>
    ___________________
    codebehin
        protected void RadRating1_Rate(object sender, EventArgs e)
        {
            RadRating oRating = (RadRating)sender;

    ?? DataKeyNames  < grid?
    how mach?

    }
  10. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Feb 2012 Link to this post

    Hello,

    Try the following code.
    C#:
    protected void ratg_Rate(object sender, EventArgs e)
    {
     RadRating rating = (RadRating)sender;
     GridViewRow row = (GridViewRow)rating.NamingContainer;
     string ID =GridView1.DataKeys[row.RowIndex].Value.ToString();
    }

    Thanks,
    Princy.
  11. Mohamad
    Mohamad avatar
    15 posts
    Member since:
    Feb 2012

    Posted 29 Feb 2012 Link to this post

    I very much thanks.
  12. Mohamad
    Mohamad avatar
    15 posts
    Member since:
    Feb 2012

    Posted 02 Mar 2012 Link to this post

    Got a question about ajax
    I have code as follows.

        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
     <asp:GridView ID="GridView1" runat="server"  DataKeyNames="TopicID"
            AutoGenerateColumns="False" ShowHeader="False" BorderStyle="None"
            GridLines="None" Width="100%" onrowcommand="GridView1_RowCommand">
    <Columns>
    <asp:TemplateField>
    <ItemTemplate>
    <telerik:radrating ID="RadRating1" OnRate="RadRating1_Rate" AutoPostBack="True" Runat="server" Skin="Forest" Orientation="Horizontal"  SelectionMode="Single" ItemCount="5" />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>

        </ContentTemplate>
        </asp:UpdatePanel>
    _____
    CodeBehin
     protected void RadRating1_Rate(object sender, EventArgs e)
        {

            RadRating rating = (RadRating)sender;
            GridViewRow row = (GridViewRow)rating.NamingContainer;
            string ID = GridView1.DataKeys[row.RowIndex].Value.ToString();
        }
    __________
    then Is Problem in sending
    What do you recommend you send a Ajax

  13. Slav
    Admin
    Slav avatar
    1356 posts

    Posted 06 Mar 2012 Link to this post

    Hi Mohamad,

    What is the exact problem that you have encountered, as your case is not clear from the presented  description? I have attached a sample page that uses your code as a base and demonstrates an Ajaxified GridView which contains RadRating and detects the currently clicked row. I would suggest comparing it with your actual project and checking if there are differences in the setup.

    Please provide reliable steps for reproducing the issue, so that I can suggest an according solution, as currently I am mostly guessing as to what your scenario is.

    Regards,
    Slav
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  14. Mohamad
    Mohamad avatar
    15 posts
    Member since:
    Feb 2012

    Posted 06 Mar 2012 Link to this post

    When I use code like
    is Inactive
    update panel.
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>

                </ContentTemplate>
            </asp:UpdatePanel>

    Between them, if not working properly oki

    I want >
    </ContentTemplate>
    <Triggers>
    ????Code is required
    </Triggers>
    </asp:UpdatePanel>
  15. John
    John avatar
    3 posts
    Member since:
    Dec 2011

    Posted 08 Mar 2012 Link to this post

    Hello Mohamed,

    I cannot quite understand your problem. By default, any postback control inside an UpdatePanel control causes an asynchronous postback and refreshes the panel's content. You can also configure other controls on the page to refresh an UpdatePanel control. You do this by defining a trigger for the UpdatePanel control. A trigger is a binding that specifies which postback control and event cause a panel to update. When the specified event of the trigger control is raised (for example, a button's Click event), the update panel is refreshed. In the following code you can see how the inner property Triggers of UpdatePanel is used for setting the id of the control that triggers Ajax postback:
    <asp:UpdatePanel ID="UpdatePanel1"
                     UpdateMode="Conditional"
                     runat="server">
                     <Triggers>
                       <asp:AsyncPostBackTrigger ControlID="Button1" />
                     </Triggers>
                     <ContentTemplate>
                     ....
                     </ContentTemplate>
    </asp:UpdatePanel>

    Here you can find additional information on UpdatePanel.

    John
  16. Mohamad
    Mohamad avatar
    15 posts
    Member since:
    Feb 2012

    Posted 09 Mar 2012 Link to this post

    Thank you reply john.
    no Button1
    RadRating1_Rate < event not
    I'm with the events that you can click on radrating
    It is within this section < UpdatePanel
    You see
    I'll see if it
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
    <ContentTemplate>
    <asp:GridView ID="GridView1" runat="server" DataKeyNames="ID" AutoGenerateColumns="False"
    ShowHeader="False" BorderStyle="None" GridLines="None" Width="100%"
    DataSourceID="SqlDataSource1">
    <Columns>
    <asp:TemplateField>
    <ItemTemplate>                
    <telerik:radrating ID="RadRating1" OnRate="RadRating1_Rate" AutoPostBack="True" Runat="server"
    Skin="Forest" Orientation="Horizontal"  SelectionMode="Single" ItemCount="5" />
    </ItemTemplate>
    </asp:TemplateField>
    </Columns>
    </asp:GridView>
    </ContentTemplate>
    <Triggers>
    <asp:PostBackTrigger ControlID="GridView1" />
    </Triggers>
    </asp:UpdatePanel>
    code
        protected void RadRating1_Rate(object sender, EventArgs e)
        {
            RadRating rating = (RadRating)sender;
            GridViewRow row = (GridViewRow)rating.NamingContainer;
            string ID = GridView1.DataKeys[row.RowIndex].Value.ToString();
        }
    _____________________
    If the code is intended only for the same Verse.
    It makes PostBack ?With this code
    <Triggers>
    <asp:PostBackTrigger ControlID="GridView1" />
    </Triggers>

    I do not want the way.
    ControlID="GridView1" /> <<This form should be < RadRating1_Rate
    Not identifiable because for grid
  17. John
    John avatar
    3 posts
    Member since:
    Dec 2011

    Posted 14 Mar 2012 Link to this post

    Hello Mohamed,

    It seems that you are trying to set the RadRating in the GridView as update trigger for the UpdatePanel control. This can be done by referencing the RadRating in the rows of the grid and configuring it as trigger on the server-side. This forum thread describes the overall approach that should be used. For more information you can also check this Google search.

    John
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017