I have a gridview and Inside gridview have AjaxControlToolkit rating control and label. I Want to assign rating value to gridview label but value is coming inside Rating1_Changed event but after assign to label then not showing in gridview. If I will keep
rating control autopostback=true means Rating1_Changed is not firing.
protected void Rating1_Changed(object sender, AjaxControlToolkit.RatingEventArgs e)
{
AjaxControlToolkit.Rating rating = (AjaxControlToolkit.Rating)sender; //get the rating control
string value = e.Value; //get rating value.
GridViewRow row = (GridViewRow)rating.NamingContainer; //using NamingContainer to find the GridViewRow
Label lbl = (Label)row.FindControl("lblRating"); //using the findcontrol method to find the label
lbl.Text = value; //set the value.
}
The screenshot as below:
Best regards,
Dillion
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
213 Points
519 Posts
Not Able to Assign Rating value to gridview label using asp.net C# using Visual Studio 2013
Apr 26, 2017 11:27 AM|mazhar khan india|LINK
I have a gridview and Inside gridview have AjaxControlToolkit rating control and label. I Want to assign rating value to gridview label but value is coming inside Rating1_Changed event but after assign to label then not showing in gridview. If I will keep rating control
autopostback=true
means Rating1_Changed is not firing.Below is my code behind c#.
Why If I will keep rating control to
autopostback=true
means not firing. Please help to out this.All-Star
37121 Points
14979 Posts
Re: Not Able to Assign Rating value to gridview label using asp.net C# using Visual Studio 2013
Apr 26, 2017 11:38 AM|mgebhard|LINK
Duplicate post!
https://forums.asp.net/t/2120397.aspx?Event+fires+only+when+autopost+false+in+asp+net+4+5+vs+2013+with+Ajaxcontroltoolkit+16+1+1+0
Member
213 Points
519 Posts
Re: Not Able to Assign Rating value to gridview label using asp.net C# using Visual Studio 2013
Apr 26, 2017 11:40 AM|mazhar khan india|LINK
I have change question please help to out this issue. Thank you
Member
213 Points
519 Posts
Re: Not Able to Assign Rating value to gridview label using asp.net C# using Visual Studio 2013
Apr 26, 2017 11:43 AM|mazhar khan india|LINK
Dear mgebhard,
your answer is below like that here I explain easy way.
First, you need to explain what "it does not work" means. Could the issue be the page logic redirects before the OnChange event fires?
All-Star
45439 Points
7008 Posts
Microsoft
Re: Not Able to Assign Rating value to gridview label using asp.net C# using Visual Studio 2013
Apr 27, 2017 09:26 AM|Zhi Lv - MSFT|LINK
Hi mazhar,
As for this issue, I suggest you could refer to the following code:
Code behind:
The screenshot as below:
Best regards,
Dillion
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.