Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. 5 Star Rating Control using CallBack

5 Star Rating Control using CallBack

Scheduled Pinned Locked Moved C#
designdebugging
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • N Offline
    N Offline
    Neeraj Kr
    wrote on last edited by
    #1

    I am creating a 5 star rating control. For this I have created a user control with the Callback functionality. When I implement the usercontrol on an aspx page, I want that the label control to populate the value of the image that was clicked. But, when I debug my application, it shows that the label control has the value and it does not show on the page. Following is the code I am using for the User Control: public event System.Web.UI.WebControls.CommandEventHandler Rater; protected void Page_Load(object sender, EventArgs e) { sCallBackFunctionInvocation = Page.ClientScript.GetCallbackEventReference(this, "message", "ShowSuccess", "context"); String callbackScript; callbackScript = "function CallServer(message, context)" + "{ " + sCallBackFunctionInvocation + ";}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true); } public void RaiseCallbackEvent(string eventArgument) { if (hdn.Value.ToString() == "" && (eventArgument == "0" || eventArgument == string.Empty)) { returnValue = "0"; totChecked = returnValue; hdn.Value = returnValue; } else { returnValue = eventArgument; hdn.Value = returnValue; totChecked = returnValue; CommandEventArgs args = new CommandEventArgs("Rated", hdn.Value.ToString()); Rater(this, args); } } public string GetCallbackResult() { return returnValue; } The following code is used for aspx page protected void Page_Load(object sender, EventArgs e) { rc1.Rater += new CommandEventHandler(rc_Rater); } private void rc_Rater(object sender, CommandEventArgs e) { RatingControl rc = new RatingControl(); lbl.Text = e.CommandArgument.ToString(); }

    -----Have A Nice Day-----

    S 1 Reply Last reply
    0
    • N Neeraj Kr

      I am creating a 5 star rating control. For this I have created a user control with the Callback functionality. When I implement the usercontrol on an aspx page, I want that the label control to populate the value of the image that was clicked. But, when I debug my application, it shows that the label control has the value and it does not show on the page. Following is the code I am using for the User Control: public event System.Web.UI.WebControls.CommandEventHandler Rater; protected void Page_Load(object sender, EventArgs e) { sCallBackFunctionInvocation = Page.ClientScript.GetCallbackEventReference(this, "message", "ShowSuccess", "context"); String callbackScript; callbackScript = "function CallServer(message, context)" + "{ " + sCallBackFunctionInvocation + ";}"; Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "CallServer", callbackScript, true); } public void RaiseCallbackEvent(string eventArgument) { if (hdn.Value.ToString() == "" && (eventArgument == "0" || eventArgument == string.Empty)) { returnValue = "0"; totChecked = returnValue; hdn.Value = returnValue; } else { returnValue = eventArgument; hdn.Value = returnValue; totChecked = returnValue; CommandEventArgs args = new CommandEventArgs("Rated", hdn.Value.ToString()); Rater(this, args); } } public string GetCallbackResult() { return returnValue; } The following code is used for aspx page protected void Page_Load(object sender, EventArgs e) { rc1.Rater += new CommandEventHandler(rc_Rater); } private void rc_Rater(object sender, CommandEventArgs e) { RatingControl rc = new RatingControl(); lbl.Text = e.CommandArgument.ToString(); }

      -----Have A Nice Day-----

      S Offline
      S Offline
      Simon P Stevens
      wrote on last edited by
      #2

      Probably best to ask this in the ASP[^] forum.

      Simon

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups