Rating control not appearing - asp.net

I am trying to use the ASP.NET ajax rating control on my ASP.NET website. I have followed the exact steps from the video tutorial to use this rating control.
Here's my HTML code.
<div id="Rating" style="float:right; width:400px">
<div class="demoheading">Rating demonstration
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<div style="float:left;width:230px">
How much do you like this profile?
</div><br />
<asp:Rating ID="LikeRating" runat="server" CurrentRating="3" MaxRating="5"
StarCssClass="ratingStar" WaitingStarCssClass="savedRatingStar" FilledStarCssClass="filledRatingStar"
EmptyStarCssClass="emptyStarRating"
style="float:left" onchanged="LikeRating_Changed1" Height="40px"
Width="400px">
</asp:Rating><br />
<div style="clear:left;">
<asp:Button ID="ButtonSubmit" runat="server" Text="Submit" />
<asp:Label ID="LabelResponse" runat="server" Text="[No response provided yet]"></asp:Label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br /><br />
</div>
</div>
My rating control is not appearing in the designer. However, when I hover that blank space it should be, it shows me the rating number as in the figure below. I did check the path of the images and the css I used for the star rating. Is there still something I am missing?

You do not have the proper path to your image or the images do not exist. The control is there, the styles that you declare for the different type of stars do not have the images.
Also, you are missing a semicolon here:
emptyStarCssClass="emptyStarRating"
style="float:left"
should be
emptyStarCssClass="emptyStarRating"
style="float: left;"
I would recommend inspecting the element to check what it shows the image path is.
I missed the in designer part. I have experienced some issues where designer does not quite understand the image paths and will flag the path as bad, but in actuality it is fine. Have you tested the page in debug mode?

Related

Multilingual web application change div text?

I am working with asp.net web application multilingual site.
I am using following link :
http://techaxe.com/2010/09/04/creating-multilingual-website-using-asp-net/
Here we have file in my App_LocalResource folder for change text content. It's work good with label control.
<asp:Label ID="Label1" runat="server" Text="<%$Resources:AboutText%>"></asp:Label>
Here I want to change my div content as per selected language.
<div class="registration_content" runat="server">
<%$Resources:AboutText%> </div>
Please suggest me how I can change div content as per local resource variable.
Thanks for any suggestion..
You could use an asp:Literal tag:
<div class="registration_content" runat="server">
<asp:Literal runat="server" Text="<%$Resources:AboutText%>" />
</div>

IE not catching Enter key for form submission

I have a simple form with one text box that pass data to SQL and I want it to submit when the user hits the enter key.
In Firefox, this works great. The user puts a number hits enter gets back the results.
However in IE 8 and IE 9 this is not working.
<form id="form1" runat="server" accept="cmdclick"
style="background-position: center; background-image: url('BG.gif'); background-repeat: no-repeat;">
<div style="text-align: center">
<br /><br /> <br /><br /><br /> <br /><br /><br />
<asp:TextBox ID="txttrack" runat="server" Height="20px"
Width="175px" Wrap="False"></asp:TextBox>
<asp:Button ID="cmdclick" runat="server"
CommandName="cmdclick" BackColor="White" BorderStyle="None" />
I am not sure what would cause this. I see a lot of people using JavaScript to go around the problem however I do not know how to write JavaScript code.
How can this be done (preferably without JavaScript)?
Set the DefaultButton-Property in Form-Tag:
<form defaultbutton="cmdclick" runat="server">
You can also set the DefaultButton on ASP.NET-Panels. This might not be important in this case but
when you're using MasterPages, because the ID of a Button in a ContentPage is unknown in a MasterPage (Form-Tag is inside the Masterpage)
when you want to have more than one DefaultButton you can set different DefaultButtons to every Panel
If you have recursive form elements (which is against standards compliance) then IE will basically ignore the enter key and not submit the form when it is detected as it doesn't know which form you are trying to submit.

ASP.net WebPart title icons

I'm creating a web part page in ASP.net i want to display icons for minimise, restore, close etc instead of the drop down menu which is currently showing. This code adds an icon next to the minimise icon in the menu but i want to remove the menu completly and render 3 icons in the top right of each web part. Does anyone have an example how to achieve that?
<asp:WebPartManager ID="WebPartManager1" runat="server" Personalization-Enabled="true" >
</asp:WebPartManager>
<asp:WebPartZone ID="WebPartZone1" runat="server" HeaderText="zone 1"> <MinimizeVerb ImageUrl="img/os_minimise.gif" />
<ZoneTemplate>
<asp:Label ID="lblZone1Header" runat="server"><h1>Zone 1</h1></asp:Label>
<uc1:TestControl ID="TestControl1" runat="server" />
</ZoneTemplate>
</asp:WebPartZone>
<asp:WebPartZone ID="WebPartZone2" runat="server" HeaderTexxt="zone 2">
</asp:WebPartZone>
<asp:EditorZone ID="EditorZone1" runat="server">
<ZoneTemplate>
<asp:AppearanceEditorPart ID="AppearanceEditorPart1" runat="server" />
</ZoneTemplate>
</asp:EditorZone>
Web Part Zone has a property WebPartVerbRenderMode set it to menu and then Set Icons for Minimize,Restore,Close verbs etc.

File upload control - Select file is lost when 2nd control is initiatied

Our problem/question revolves around an upload control that loses the selected file (goes blank) when a postback control is used (in this case, the dropdown list posts). Any insight into what we are doing wrong or how we can fix this? Below is our code and a summary of the problem.
Any help would be greatly appreciated.
Thank you!
<asp:updatepanel id="UpdatePanel1" runat="server">
<ContentTemplate>
<div class="row">
<asp:DropDownList runat="server" AutoPostBack="true" ID="CategorySelection" OnSelectedIndexChanged="CategorySelection_IndexChanged" CssClass="drop-down-list" />
</div>
<div id="SubCategory" class="row" runat="server" visible="false">
<asp:DropDownList runat="server" ID="SubCategorySelection" CssClass="drop-down-list" />
</div>
<div class="row">
<asp:FileUpload runat="server" ID="FileUpload" CssClass="file-upload" />
</div>
<div class="row">
<asp:Button ID="submit" runat="server" Text="Submit" CssClass="button" OnClick="submit_ButtonClick" />
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="submit" />
</Triggers>
</asp:updatepanel>
In this form we have 2 DropDownList, 1 FileUpload and 1 submit button. Every time that the user selects one category, the subcategories are loaded (AutoPostBack=”true”).
The primary user flow works fine: User selects one category, subcategory and selects a file to be uploaded (submitted). HOWEVER, if the user selects a file first, and then selects a category, the screen will do a partial refresh and the selected file will disappear (field goes blank). As a result, the user needs to select the file again. This causes an issue because the fact that the file is no longer selected can easily be overlooked.
Seems straighforward --- but causing us a lot of grief. Any experts out there that can help?
BIG thanks!
That is the behavior of the input type=file i.e. it can't be pre-populated. Move the FileUpload outside of the UpdatePanel. In your markup, you could move both FileUpload and the submit Button outside of the UpdatePanel.

ASP.NET Form Validation Doesn't work first time

<asp:UpdatePanel ID="LoginPanel" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div id="login">
<div class="row">
<div class="label">
<asp:Label ID="lblUsername" Text="<%$ Resources:Login, UserNameField %>" runat="server" />
</div>
<div class="field">
<asp:TextBox ID="txtUsername" MaxLength="12" runat="server" />
<asp:RequiredFieldValidator ID="rfvUsername" ControlToValidate="txtUsername" ValidationGroup="vgLogin" SetFocusOnError="true"
ErrorMessage="*" ToolTip="<%$ Resources:Login, UserNameRequired %>" runat="server" />
</div>
</div>
<div class="row">
<div class="label">
<asp:Label ID="lblPassword" Text="<%$ Resources:Login, PasswordField %>" runat="server" />
</div>
<div class="field">
<asp:TextBox ID="txtPassword" MaxLength="12" TextMode="Password" runat="server" />
<asp:RequiredFieldValidator ID="rfvPassword" ControlToValidate="txtPassword" ValidationGroup="vgLogin" SetFocusOnError="true"
ErrorMessage="*" ToolTip="<%$ Resources:Login, PasswordRequired %>" runat="server" />
</div>
</div>
<div class="row">
<div class="label">
<asp:Label ID="lblRemember" Text="<%$ Resources:Login, RememberField %>" runat="server" />
</div>
<div>
<asp:CheckBox ID="chkRemember" Checked="true" ToolTip="<%$ Resources:Login, RememberToolTip %>" runat="server" />
</div>
</div>
<div class="buttons">
<asp:Button ID="btnLogin" Text="<%$ Resources:Login, Command %>" OnClick="btnLogin_Click" ValidationGroup="vgLogin" CausesValidation="true" runat="server" />
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
The first time around, validators won't check whether the fields are completed or not, the form just gets submitted no matter what, after that initial hiccup, the form validates correctly each time.
I know I can just ask (and should, regardless) if Page.IsValid at server-side, but I still would like the validation to correctly alert the user input mistake the first time around instead of waiting for the server response first.
What am I doing wrong?
The load order of the JS files may be causing problems here, if there are dependencies between them. Because of random latency some dependencies might not have been satisfied yet, causing functionality to break. Your console might give hints if this is the case. On subsequent page loads everything appears to be fine, because the JS files were cached and are now loaded without latency in their proper order.
Things to try:
Play around with JS inclusion order
Try to postpone the use of
dependencies until after body.onload
fired.
You may also want to try out
the rather involved solution
offered on aspdotnetfaq.
Hope this helps.
I've had something similar happen when there was a large amount of javascript being loaded, or when there is an unrelated javascript error (usually but not always related to the large amount of javascript.
This may not be much of an answer, but Ive run into similar issues in the past. ASP Validation Controls dont really seem to "play nice" inside of UpdatePanels. I think the reason is that when they attempt to perform any type of validation, they also attempt to write to the pages viewstate. The viewstate however is outside of the Update Panel's area, meaning that you are update the "middle" of the page, without the entire page's state getting updated, making the status of your controls out of sync.
In any case, to prove this, remove the update panel from around your controls, submit your form, and check if your validation controls work.
Unfortunately, for a workaround, Ive created custom javascript functions to perform client side validation, and then also perform server side validation and display any errors. In these scenario's, Ive avoided using ASP .NET Validation controls.
Good luck =\

Resources