umbraco value doesn't show - asp.net

I'm working in local and I have my database in local.
But when I want to take an umbraco value it doesn't show anything.
Like this
<ul>
<umbraco:Item fieeld="contact" runat="server" />
</ul>
I have no idea why, someone who can me explain why?

If it's inside a template, the right way is this:
<umbraco:item field="propertyAlias" runat="server" />
But if it's inside a macro you must use:
Model.GetProperty("propertyAlias").Value

Related

Nested application and absolute path of html tags

The deal is that when you have the following on your site it works:
Click Me!
But the above fails to work if that site is a nested application.
I have seen two solutions to this opportunity in asp.net.
The first solution that I found was to add the following:
<a runat="server" href="~/Some/Path/file.aspx" class="button">Click Me!</a>
I have not tried this because I feel it would add more crap to your view state.
The solution that I have tried is:
Click Me!
The question is, what is the preferred method of addressing paths in nested applications?
You want to use HyperLink server control. It is meant for that kind of thing.
<asp:HyperLink runat="server" ID="HyperLink1"
NavigateUrl="~/Some/Path/file.aspx"
CssClass="button">Click Me!</asp:HyperLink>
Render as
<a id="HyperLink1" class="button" href="/Some/Path/file.aspx">Click Me1</a>
ASP.Net HyperLink control uses ResolveClientUrl to resolve the given url, so you do not need to do anything.

How to pass dynamic form inputs (asp:TextBox) correctly

I have a page that looks like this:
Head and body tags...
<form runat="server">
<ul>
<asp:RequiredFieldValidator runat="server" id="reqUser" controltovalidate="Username" errormessage="<li>There is no username!</li>" />
More validators...
</ul>
<h3><span style="color: Red;">*</span>Username</h3>
<asp:TextBox runat="server" id="Username" /></br>
More textboxes...
</form>
The thing is, I discovered that based on the id from the <asp:Textbox />, the names are created, but with a strange format (id=" MainContent_originalID" and name="ctl00$MainContent$originalID")
For me it is ok to have it submit the form to itself. The code works to handle that. The problem is, I don't know if when I use Request.Form["Name"] I have to use the original ID or the suplied name after processing. What to I do?
I believe in the code you do have to use the supplied name after processing. But, I think there may be a way to get that name based on the original name.
Something like:
originalName.ClientID
See: http://www.codeproject.com/Tips/95796/How-to-get-the-id-name-of-the-ASP-NET-server-contr
P.S. You have to use the original ID name with the statement (controllName.UniqueID)

How to give path for image in a master page for two sub-pages in two locations?

Hi all my work environment is asp.net c# vs2008. My issue is this, i have a master page outside.master in shared folder.Inside it i have an image control with
<img src="App_Themes/Home/images/logo.png" />
i am referring this master page from in two sub pages. One is Index.aspx which is located in the root level and Secondly registration.aspx which is under masters folder. The problem is that when i run, the index.aspx will show the logo where registration.aspx is not showing the logo. Please tell me how to specify the path so that i will get logo in both pages.
Tilde sign ~ will resolve for server side controls.
So you need to add runat="server" as img in HTML element.
Try this:
<img src="~/App_Themes/Home/images/logo.png" runat="server"/>
The most foolproof method is to have something like this
<asp:Image runat="server" id="myImage" ImageUrl='<%# Eval("imageFile") %>' />
Then in the code-behind assign the variable imageFile to something like Server.MapPath("App_Themes/Home/images/logo.png");
Try the following:
<img src="~/App_Themes/Home/images/logo.png" runat="server" />

Themes, virtual path and base href

I have created a theme with a skin, including e.g. following:
<asp:Image runat="server" runat="server" SkinID="SquareCopy"
ImageUrl="~/App_Themes/MyTheme/square_copy.png" />
This would create (depending from what page I call it):
<img src="../App_Themes/MyTheme/square_copy.png">
What would I need to do if I only wanted (no ../):
<img src="App_Themes/MyTheme/square_copy.png">
I tried to ommit ~/: ImageUrl="App_Themes/MyTheme/square_copy.png" />
But this doesn't seem to have any effect. The reason why I want to have fix paths is the use of base href through the whole project.
Thx for any suggestions!
Edit:
Interesting, if I use a Image-Control without skin-id, I can make it render the path as I would like to have it:
<asp:Image id="Image1" runat="server"
ImageUrl="App_Themes/MyTheme/square_copy.png"/>
Results in:
<img id="MainContent_Image1" alt="Image text"
src="App_Themes/VolunteerClient/square_copy.png">
Base url of the element defined in skin file will always be
App_Themes/MyTheme/
where MyTheme is a name of your theme.
eg.
Path="~/App_Themes/MyTheme/Images/a.jpg"
will be resolved to
Path="App_Themes/MyTheme/Images/a.jpg"
also
Path="Images/a.jpg"
will be resolved to
Path="App_Themes/MyTheme/Images/a.jpg"
If you want to change that behaviour you will need to overwrite path.
Hope that helps
Try something like this...
<asp:Image runat="server" runat="server" SkinID="SquareCopy"
ImageUrl="<%= Page.ResolveClientUrl("~/App_Themes/MyTheme/square_copy.png") %>" />

Can I use update panels with jQTouch?

I am using ASP.NET controls to fill in HTML for my jQTouch application, but I am having trouble with my hrefs ceasing to function as intended on my search page. The jQuery function for my anchor class evidently does not get called; it simply links back to the default page, even though the link is built similarly on other pages without any problems.
This is where my links are breaking:
<form id ="form1" runat="server" class="form">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<asp:UpdatePanel runat="server" ID="up1">
<ContentTemplate>
<ul class="rounded">
<li><asp:TextBox ID="txtSearchString" runat="server" name="search-articles" placeholder="Search GROK"></asp:TextBox></li>
<li><asp:Button ID="btnSearch" runat="server" Text="Search" type="rounded" OnClick="btnSearch_Click"></asp:Button></li>
</ul>
<asp:Literal ID="litSearchResults" runat="server"></asp:Literal> <%--HTML for jQTouch inserted here--%>
</ContentTemplate>
</asp:UpdatePanel>
</form>
This is an example of the HTML generated by code behind.
<ul class="edgetoedge"><li class="sep">Found 101 articles</li><li>PAWS: How to Access the Sample Test Database</li><li>Mac OS X: Hardware Test</li><li>The JavaScript Test</li><li>PAWS: Emergency Text Message Test</li><li>Definition: remote digital loopback test</li><li>Definition: power-on self test</li><li>Definition: power-on self test</li><li>AVG 9.0 Free Edition: Setting Scan Process Priority</li><li>Microsoft Office 2007: Diagnostics</li><li>Moodle: Description of Aggregation Methods</li><li>AVG 9.0 Free Edition: How can I run the complete scan of whole computer?</li><li>LSU A-Z: Office of Assessment and Evaluation</li><li>Linux: sed Insert a Newline Into the RHS of a Substitution</li><li>Microsoft PowerPoint 2007: Narrating a Slide</li><li>Ubuntu: Deleting Undeletable Files In the Trash</li><li>Linux: Remove All Digits/ Input From Inputs</li><li>SQL: Create a MySQL DocDB Databse</li><li>Linux Gnome: Screens and Graphics</li><li>Linux Xfce: Adjust keyboard settings</li></ul>
jQTouch handles every other tag normally, it is just the anchors that have ceased to function as intended by being placed inside this form. Can I keep using update panels here or will it inevitably break? Is there a work-around? Or am I approaching the problem incorrectly?
Keep in mind I want to retain the AJAXical animations produced by jQTouch. If you find that I am unclear or you would like to see more code (I only included what I believe to be necessary), please let me know.
Bonus points if you can tell me how to get jQTouch to replace the ugly the ASP.NET button control with an iPhoney button. :)
I think you are going to have to do a ton of hacks to get ASP.Net working with jqtouch with update panels, as you are going to be fighting the JavaScript inserted by ASP.Net with the JavaScript that jqtouch inserts. In your example all your links are going to the same anchor (#article). To do this in a jQtouch kind of way, you would have all the the links going to '#' and handle the tap of the articleLinkClass and then adjust as you need to.
$('.articleLink').tap(function()
{
var id = $(this).val('id');
// Pseudo CODE HERE FOR Setting up the article based on id... E.g.
$.json(jsonServiceUrl, { article_id: id }, function(data)
{
$('#article data).html(data);
});
jQt.goTo('article'); // Display the article page...
});
The iPhoney buttons are created in jQtouch as 's with their class as "whiteButton", i.e.:
<a id="myTestButton" class="whiteButton">Test Button</a>
Hope this helps...

Resources