I've got a webpart which fetches items and their ratings from an SharePoint list.
I've managed to show the rating for each item using the RadRating control. I've looked into the assembly using the Object Explorer and found only one System.EventHandler, named Rate. I've tried attaching my own event handler to handle the logic of getting the new value and passing that over to SharePoint, but for some reason I can't seem to figure out how to get the event from rating an item.
Here's a code snippet including how I display the RadRating and try to catch the events when the User rates by using the RadRating:
And here's my QARating_Rate where I've put a breakpoint into my foo string for testing...
The thing is, while debugging and clicking the stars in the browser, it won't hit the QARating_Rate method ever. What am I doing wrong?
I've managed to show the rating for each item using the RadRating control. I've looked into the assembly using the Object Explorer and found only one System.EventHandler, named Rate. I've tried attaching my own event handler to handle the logic of getting the new value and passing that over to SharePoint, but for some reason I can't seem to figure out how to get the event from rating an item.
Here's a code snippet including how I display the RadRating and try to catch the events when the User rates by using the RadRating:
foreach
(SPListItem answerItem
in
answerListItems)
{
Literal QAContent =
new
Literal();
RadRating QARating =
new
RadRating();
QAContent.Text =
"<div class='qaAnswer'>"
;
//<Snip>
if
(answerItem[
"Luokitus_x0020__x0028_0_x0020__x"
] !=
null
)
{
try
{
string
ratingValue = answerItem[
"Luokitus_x0020__x0028_0_x0020__x"
].ToString();
QARating.Value = Int32.Parse(ratingValue);
QARating.AutoPostBack =
true
;
QARating.Rate +=
new
EventHandler(QARating_Rate);
pnlQuestios.Controls.Add(QARating);
}
catch
{}
}
QAContentEnd.Text +=
"</div>"
;
pnlQuestios.Controls.Add(QAContentEnd);
}
And here's my QARating_Rate where I've put a breakpoint into my foo string for testing...
protected
void
QARating_Rate(
object
sender, EventArgs e)
{
string
foo =
"foo"
;
}
The thing is, while debugging and clicking the stars in the browser, it won't hit the QARating_Rate method ever. What am I doing wrong?