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>
Related
I work on VS2012 C# Asp.net web page application, want to apply angular on my application , At first I include angular files containing a file “angular.min.js” in my project and Include its reference in my master page
<script src=”Scripts/angular.min.js” type=”text/javascript”></script>
So far I know AngualrJS has several directives which perform different tasks. At first write “ng-app” directive in a div or master page body tag. It initializes an AngularJS application. It is the root element of the application allowing behavior to be modified through custom HTML tags.
I add on master page then on child page(default.aspx) add bellow syntax:
<div >
<asp:TextBox ID="TextBox1" runat="server" ng-model="name"></asp:TextBox>
<br />
<asp:Label ID="Label1" runat="server" Text="Label" ng-bind="name"></asp:Label>
</div>
The ng-bind directive not binds application data to the HTML view. I can not see the value of data on runtime.
when I use bellow syntax it’s work perfectly
<div ng-app="">
<asp:TextBox ID="TextBox1" runat="server" ng-model="name"></asp:TextBox>
<br />
<asp:Label ID="Label1" runat="server" Text="Label" ng-bind="name"></asp:Label>
</div>
Both syntax are same except the additional ,why I need to add ng-app="" on child page ,I already add this on master page body .
if have any query please ask.Thanks in advanced ,any type of suggestion will be acceptable
I have a image control on a asp.net page and the imageurl is set. The image shows normal in the designer but doesnt open in the browser?? What can be wrong with it? What else should be set then the image url???
Help much appreciated
<form id="form1" runat="server">
<div class="style1">
<h1>A Basic Website<asp:Image ID="Image2" runat="server" Height="93px"
ImageAlign="Right" ImageUrl="~/App_LocalResources/Winter.jpg" Width="263px" />
</h1>
<img src="~/Images/mypic.jpg" alt="My Pic" runat="server" />
Use the tilda (~/) operator and the runat attribute so that the path resolves on the server side.
I also suggest not using designer view - use code view and your browser for regular design work. Try the Firefox Web Dev Toolbar.
To use the image control:
<asp:Image ID="Image1" runat="server"
ImageUrl="~/Images/ASPdotNET_logo.jpg"
AlternateText="ASP.NET Logo">
Here's a walkthrough...
Thank you sooooooo much for the help, I found the solution, I was using app_resources folder which didnt work, but when I renamed the folder it did.... so thanks for taking the time to show the way :)
Hello I found next strange as for me behavior of Literal in Asp MVC out put and I don't know how to fix it.
I have next part of html code on aspx page
...
<p class="description">
<asp:Literal ID="lblDescription" runat="server" EnableViewState="false"></asp:Literal>
</p>
...
On page load event I try to show user text:
lblDescription.Text = stringVar;
string var can contain other html tag like p, div, etc
But when my page loaded I see all html that should be inside was created under this element.
some text
Does any one know why ?
thanks
Try this:
<asp:Literal ID="lblDescription" Mode="PassThrough" runat="server" EnableViewState="false"></asp:Literal>
MSDN: Mode Property
The default value of ClientIDMode for a page is AutoID. The default
value of ClientIDMode for a control is Inherit. If you do not set
ClientIDMode for a page or for any controls on the page, all controls
will use the AutoID algorithm.
This is from msdn. But when I created a web application in ASP.NET 4 or even 3.5, all of the ids of the control are what I have written for them. They are not generated by the autoId algorithm. Then I tried to manually add clientIDMode="AutoID" to the controls, it also doesnt work what I was expected. So what is the problem ? Is there any rule to make it available ?
Thanks in advance,
EDITED
This is in .aspx page
<div>
<asp:Panel ID="Panel1" runat="server">
<asp:Panel ID="Panel2" runat="server">
<asp:Panel ID="Panel3" runat="server">
<asp:Panel ID="Panel4" runat="server">
(:
</asp:Panel>
</asp:Panel>
</asp:Panel>
</asp:Panel>
</div>
This is output:
<div id="Panel1">
<div id="Panel2">
<div id="Panel3">
<div id="Panel4">
(:
</div>
</div>
</div>
</div>
The reason you are getting all your Id's coming out the way you are is because there is no reason for the .NET framework to change them.
If you had placed your Panel's within a Repeater control, then they would all change to avoid multiple ID's of the same name.
Example (not correct markup):
<asp:Repeater id="repeater1" runat="server">
<template>
<asp:Panel id="Panel1" runat="server">
<asp:Panel id="Panel2" runat="server">
</asp:Panel>
</asp:Panel>
</template>
</asp:Repeater>
Your HTML which is generated from this would show that the Panel id's have been changed to inherit from the containing control. Something like repeater1_ct100_Panel1
The same happens when you are using Master Pages, Content Holders, and DataBound Controls. .NET updates the ID's to avoid multiple ID's of the same name.
The differences between the different ClientIDMode values can be clearly seen if you nest one control into another; the AutoId mode names the control after each parent naming container, while the Static mode starts a new naming hierarchy. Predictable mode is mostly used with data binding controls, while Inherit mode causes the control to use its parent's ClientIDMode.
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?