Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0
This is the forum to discuss the Wrox book ASP.NET 2.0 Website Programming: Problem - Design - Solution by Marco Bellinaso; ISBN: 9780764584640
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 17th, 2006, 07:26 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default mailto: in ManageUsers.aspx

Mailto in the gridview in ManageUser.aspx doesn't seem to be working as shown in the book (p.172) or in the downloaded code.

<asp:HyperLinkField HeaderText="E-mail" DataTextField="Email" DataNavigateUrlFormatString="mailto:{0}" DataNavigateUrlFields="Email" />

A search on Google suggested that we need to use a templatefield instead:

<asp:TemplateField>
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("Email") %>' NavigateUrl='<%# Eval("Email", "mailto:{0}") %>' />
                </ItemTemplate>
</asp:TemplateField>


Any comments?

 
Old August 17th, 2006, 02:17 PM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 99
Thanks: 0
Thanked 1 Time in 1 Post
Default

I'm not sure in what context the template field for your Googled source is used, so I won't comment on it. Google is probably not a good source because you don't know if the person posting is using ASP.Net 1.1 or 2.0 and frankly anyone can put up a webpage with totally false and/or misleading information. Perhaps the use of MSDN and the help files in Visual Studio are a better and more trustworthy sources.

Having used this code 3 times suggests that the problem is within your code. What is the nature of your problem?

 
Old August 22nd, 2006, 08:34 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am using the downloaded code.

In ManageUser.aspx there is a HyperLinkField containing a mailto. In the gridview this should make the user's email address clickable, however it does not. Replacing the HyperLinkField with a TemplateField makes it work.
Am I to assume it is working for you? Does anyone else have this problem?


 
Old January 23rd, 2007, 10:34 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I also have the same problem, both in the sample code downloaded from this site and with my own code based on the book.

 
Old January 23rd, 2007, 10:38 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

...and I can confirm spardoe's solution fixed it too.

 
Old January 23rd, 2007, 10:40 PM
Registered User
 
Join Date: Jan 2007
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

... not sure if it makes any difference, but I am using Visual Web Developer 2005, not Visual Studio 2005.

 
Old May 24th, 2007, 11:50 AM
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I think DataNavigateUrlFormaString="mailto:{0}" doesn't work because of the ":" character, which has a special meaning in format strings. It certainly doesn't work as provided in the downloable code.
As a side note, I believe this issue has something to do with localization. Localization is always a pain in the back when it comes to codeless databinding, where .NET assumes (quite wrongly, and there's an issue open at MS about it to be tackled at future Visual Studio Releases) all DateTime values passed as InputParameters to ObjectDataSources are in Invariant format. That format happens to be mm/dd/yyyy, which makes dd/mm/yyyy codeless databound datetime fields to cause an error when inserting/updating.
 
Old August 12th, 2009, 10:48 AM
Authorized User
 
Join Date: Aug 2009
Location: Brookline, MA
Posts: 12
Thanks: 5
Thanked 0 Times in 0 Posts
Default

I'm actually having the same problem. In my case the checkbox for the IsApproved field is also not active. I checked the source code and there is no href in the a tag and the checkboxes are disabled. I wonder if this may have to do with roles and assigning tasks to roles, or if it is because we are not using IIS. Anyone found a reason for this?

Quote:
Originally Posted by spardoe View Post
<asp:TemplateField>
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("Email") %>' NavigateUrl='<%# Eval("Email", "mailto:{0}") %>' />
                </ItemTemplate>
</asp:TemplateField>
Now it seems to me that if you are going to do a template, why use the Hyperlink object? I mean with a simple thing such as a hyperlink where we don't need to access it in server-side code, I tend to use straight HTML as much as I can. This would work:

Code:
<asp:TemplateField HeaderText="E-mail">
	<ItemTemplate>
		<a href='mailto:<%# Eval("Email") %>'><%# Eval("Email") %></a>
	</ItemTemplate>
</asp:TemplateField>




Similar Threads
Thread Thread Starter Forum Replies Last Post
Mailto: sportkr HTML Code Clinic 4 July 30th, 2008 03:21 PM
ManageUsers GameGorilla BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 10 April 16th, 2008 04:17 AM
ManageUsers Repeater issue Antilles128 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 8 March 3rd, 2008 11:47 PM
Ajax in ManageUsers mesdouri BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 3 July 2nd, 2007 08:21 AM
Mailto: paul20091968 Word VBA 2 September 29th, 2006 04:06 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.