Rating Control: cannot set currentrating in page's onload event if control is not initially visible

I have a page which contains a rating control which is initially hidden.  On the initial page load (!Page.PostBack) the CurrentRating property is set to 2.  When the page posts back the rating control is made visible, but CurrentRating property has no value.  It loses the value 2.  If the rating control is initially visible the CurrentRating is set properly and maintained properly across postbacks.  The same problem occurs if you include the rating control in a view that is not initially active in it's multiview.

<atlastoolkit:rating id="rating" runat="server" currentrating="3" visible="false" StarCssClass="ratingStar" WaitingStarCssClass="savedRatingStar" FilledStarCssClass="filledRatingStar" EmptyStarCssClass="emptyRatingStar" />

protected void Page_Load(object sender, EventArgs e) {
   if (!Page.IsPostBack)
     
rating.CurrentRating = 2;
  
else
     
rating.Visible = true;
}

0
mkerchenski
9/20/2006 9:06:51 PM
asp.net.ajax_control_toolkit 17816 articles. 1 followers. Follow

3 Replies
672 Views

Similar Articles

[PageSpeed] 6

Is there a reason you can't set the CurrentRating at the same time you make the control Visible?



http://blogs.msdn.com/Delay

This posting is provided "AS IS" with no warranties, and confers no rights.
0
David
9/20/2006 9:24:26 PM

All of the form controls on the page are being created dynamically.  Some of the controls are visible initially and some are visible when you click a button to view the next step.  It's kind of like a custom wizard control (using a multiview).  The values for the controls are retrieved from the database on the first page load.  It would be possible to go to the database to get that value separately, but due to the dynamic creation of all of the controls it would be both difficult and inefficient.

0
mkerchenski
9/21/2006 12:08:28 PM
What if you left the RatingControl Visible=true, but stuck it in a display:none Panel so it wouldn't be seen by the users? Then just unhide it by changing the Panel's style during postback. It'll be around the whole time, so the rating value should be preserved, right?

http://blogs.msdn.com/Delay

This posting is provided "AS IS" with no warranties, and confers no rights.
0
David
9/21/2006 10:49:45 PM
Reply:

Similar Artilces:

Label control's text doesn't appear to be set (in the page which has a user control )when trying to update the text property in the FormView's ItemUpdated event
Hi There,I have a user control which hosts a formview control, gridview control and a label control. The grid view is usedto show rows in the DB and when clicked to edit each row, a form view opens up in edit mode with that particular row info. So I have nothing in the item template.My first question is..is it mandatory to have smth in the itemtemplate of the form view.I have controls in edititemtemplate and insertitemtemplate.When a particular row is edited, I would like to show a status msg showing that the row has been updated.For this, I use the ItemUpdated event of the formview and try ...

How to set a Master Page's control's property through content page on a postback event?
Hi all, i m using a master page in my application. i have a panel on master page and a tab container with three tab panels on content page. i want to set/change  the visibility of the panel control when the tab is changed on the content page. By default the panel is invisible. To implement this i executed the following steps: 1. Set AutoPostBack of tacontainer to true 2. Wrote an event handler for ActiveTabIndexChanged event of the tab container 3 Wrote the following code on Tab changed event   if (TabContainerEmpPerformance.ActiveTabIndex == 1) { ...

Setting a panel control's visibility and it's affect in nested controls.
I am trying to debug a page using the panel control.  The code in the final submission of the form has logic to get data from a dropdown based on the control's visibility.  If the control's visibility is set to true, the the data is retrieved and sent to the database.The problem appears to be the dropdown control's visibility is set to false when it should not.  The dropdown is nested in a panel control.  While doing a trace, it appears when a panel control's visibility is set to false, the visibility for all controls nested under this panel are set to false as well.You'r...

Can I hide a user control's control from the hosting page's client script?
Okay, my previous question was not unswered and I guess you can't hide a control's panel with server code then show it with client code. Now this is what I try to do: on the hosting page's onload event, call a function to hide the user control's penal. Here is the deal: the user control was looped as many times as data required. So the penals will be name mypanel1, my panel2, etc... that is not even a problem if I know if the following is true: * Do all server codes finish running before the page get sent back to the client? Say the database gave me 5 penals, I can then determine how...

Setting a parent page's label control text from a user control
I have a .net 2.0 site where I'll have the same form for user input on a number of pages. I plan on using a user control for this. The catch is if the user doesn't input the data properly I want to write the error message to a label control on the parent page, not in the user control. This is because the design for each parent page is different enough that we need to display the error message in a different part of the page. I've seen a couple of websites that mention using a base page that all my pages could inherit from to have a user control interact with the parent page. This...

Unable to access user control's user control's function\property from another user control
Hi, I used to call an user control's user control function as stated below from my user control in ASP.Net 1.1 wucCompany.wucEmployee.GetEmployeeSomething() After migrating to ASP.Net 2.0, I am unable to use any properties/functions(even the public ones) of the user control's User control's from another user control.  The way I have to do is create property\function in wucCompany which calls the wucEmployee's property\function and call the wucDepartment.GetEmployeeSomething().Since I need to do this change in too many places, I can...

Rating control: Multiple instances of user control with Rating control inside errors on Page
The Rating control errors when you use it within a user control that you have multiple instances of on the same page. Assertion Failed: Duplicate use of id "Rating1_RatingProperties" for object of type "AtlasControlToolkit.RatingBehavior".Microsoft MVP - Windows Live PlatformBlog: http://pietschsoft.com | Web.Maps.VE - ASP.NET AJAX Virtual Earth Control I am having the same problem trying to use the Rating control inside of a Repeater control. I tried to ad  a unique ID to each of the Rating controls but got the same results. Have you looked at the Rater control at krispwar...

Problem to use TreeView Control in a 'content page' This Error Occur "Only Content controls are allowed directly in a content page that contains Content controls."
hi I am trying to use the TreeView Control inside the content page (Page that has a master page is a content page). On compiling the project I got the following ASP.Net runtime error: "Only Content controls are allowed directly in a content page that contains Content controls."B@b@R J Issue resolved. I was putting script tag in the content page that is not allowed. when remove the script from content page problem is resolved.B@b@R J...

necessary to register control event's js on every page load event
using the attributes property of an asp.net web server control to register some js code/function to fire in response to an event , does such registration need to occur every time the mybase.load event is triggered for the page ? is there a way save the registration information into viewstate (or some similar mechanism) ? (note : i'm not referring to the code of the js function to be triggerred -- just the "hookup" of the control's event to the js function) Yes. Custom attributes don't get persisted in the viewstate. You could add the registration information to the views...

Hook up to a control's event located on the Master Page from the Content Page PLEASE HELP
I have a master page with a button, and I what to hook the button click event on the content page I allready tried this example http://fredrik.nsquared2.com/viewpost.aspx?PostID=328&showfeedback=true but in vb it doesn't work. Thank you ALL. Master Page Code: Public Event OnbtnGrava_Click As EventHandler Protected Sub btnGrava_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnGrava.Click RaiseEvent OnbtnGrava_Click(sender, e) End Sub Content Page code: Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Dim mpButton ...

Set the control's tab order in a tab control
How can I set the control's tab sequence in a tab page? Charles Right click inside the tab page, and select Tab order from the right mouse menu. Get out of tab order using the menu or toolbar. Kent Piland Charles wrote: > How can I set the control's tab sequence in a tab page? > > Charles ...

Access parent page's controls from a user control
I have a .ascx user control that contains a button. I place this user control on a .aspx web page. The web page contains a textbox. When I click on the button in the user control I want the data in the textbox (in the web page) to be saved to the database. I want to write this code in the click event of the user control's button. Is there any way I can access the parent web page's controls from the user control? Add event to user control which fires on page when button inside user control is clicked. view post 779045Jigar Desai-----------------------Do not forget to "Mark as Answer...

How to set the visibility of a control within a User Control from the codebehind page:
  Background:In Visual Studio 2003 you must register User Controls manually in HTML.Unfortunately, this means that they are not easily accessed in your C# codebehind page as are controls that have been dragged and dropped onto the page. I have found the following method to enable setting the visibility of individual controls (such as a hyperlink) within a larger User Control (such as a navigationbar). 1)  Modify the User Control and make the individual control within it Public. Or provide Public get/set methods. 2) Place your code in the Page_Load method, for example: <code&...

Error when Loading Dynamic UserControl from current User Control's Button Click event Calling Page Event
Hi,I have a panel that I load user Control in no problem.  The problemarrises when I do a post back on one of these user controls.  I havebutton it does a click event.  In this click event I will do somedatabase updates, then I will use reflection to call a method in theparent (this.page) to load the new user control.  Its at this pointafter it loads the new user control that it throws the error "Thecontrol must be placed inside a form tag with runat=server".Now, my methods that managers the user control works.  I am able toclick on the parent page menu and...

Web resources about - Rating Control: cannot set currentrating in page's onload event if control is not initially visible - asp.net.ajax_control_toolkit

Testgarden - Metrolina Greenhouses
Metrolina Greenhouses Contact Home COMPANY PRODUCTS TOURS JOBS NEWS TEST GARDEN 2013 Test Garden Results Search our test garden plants to view ...

Fitch Rates Anixter's $400MM Senior Notes 'BB+'
(The following statement was released by the rating agency)CHICAGO, September 18 (Fitch) Fitch rates Anixter Inc.'s(Anixter) $400 million seven-year ...

Sam's Laser FAQ - Helium-Neon Lasers
A helium-neon (henceforth abbreviated HeNe) laser is basically a fancy neonsign with mirrors at both ends. Well, not quite, but really not much ...

Pulse Power Switching Devices
Copyright John Pasley 1996. This document may be freely distributed via. any means in part or in whole, however theauthors name must be included ...

TEXT-S&P summary: Mack-Cali Realty Corp.
Despite the slowdown in office fundamentals, Mack-Cali continues to outperform peers in themarkets in which it operates, with occupancy rates ...

Resources last updated: 12/26/2015 2:08:09 AM