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

How to Value Rating

15 Answers 252 Views
Rating
This is a migrated thread and some comments may be shown as answers.
Mohamad
Top achievements
Rank 1
Mohamad asked on 23 Feb 2012, 11:10 PM
<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

15 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 24 Feb 2012, 05:34 AM
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.
0
Mohamad
Top achievements
Rank 1
answered on 24 Feb 2012, 09:20 AM
tanks.
Like from the
GridView1
As
postbak
save to database
value for codbegin
no for Button1
0
Mohamad
Top achievements
Rank 1
answered on 24 Feb 2012, 01:30 PM
help me.
rate value for template gird
on postbak save to database
0
Mohamad
Top achievements
Rank 1
answered on 26 Feb 2012, 01:00 PM
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);
        }
    }
0
Slav
Telerik team
answered on 28 Feb 2012, 02:19 PM
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.
0
Mohamad
Top achievements
Rank 1
answered on 28 Feb 2012, 05:22 PM
I in the form template GridView1
I use
----------
0
Mohamad
Top achievements
Rank 1
answered on 29 Feb 2012, 09:43 AM
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?

}
0
Princy
Top achievements
Rank 2
answered on 29 Feb 2012, 11:13 AM
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.
0
Mohamad
Top achievements
Rank 1
answered on 29 Feb 2012, 06:03 PM
I very much thanks.
0
Mohamad
Top achievements
Rank 1
answered on 02 Mar 2012, 07:31 PM
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
Alpha
What do you recommend you send a Ajax

0
Slav
Telerik team
answered on 06 Mar 2012, 05:27 PM
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.
0
Mohamad
Top achievements
Rank 1
answered on 06 Mar 2012, 06:55 PM
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>
0
John
Top achievements
Rank 1
answered on 08 Mar 2012, 04:04 PM
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
0
Mohamad
Top achievements
Rank 1
answered on 09 Mar 2012, 06:13 PM
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
0
John
Top achievements
Rank 1
answered on 14 Mar 2012, 09:02 AM
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
Tags
Rating
Asked by
Mohamad
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Mohamad
Top achievements
Rank 1
Slav
Telerik team
Princy
Top achievements
Rank 2
John
Top achievements
Rank 1
Share this question
or