Solved

How to make a Search Cloud in ASP.NET C#

Posted on 2010-11-07
8
612 Views
Last Modified: 2012-08-13
How can I make a webpage with multiple URLs ? (for a Search Cloud control)
I want
http://mywebsite.com/Default.aspx

to be able to access with multiple URLs like
http://mywebsite.com/Tag1.aspx
http://mywebsite.com/Tag2.aspx
...

I already have the tagcloud control, but I don't know how to address a single webpage from multiple URLs.

Thanks !
0
Comment
Question by:evo_x
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
8 Comments
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34081838
I think the fact that you're using a TagCloud control is to some extent irrelevant...would it be fair to say that the question is how to open a single ASPX page using different names?
1. You can use a QueryString, making your urls http://mywebsite.com/Default.aspx, http://mywebsite.com/Default.aspx?tag=Tag1 and http://mywebsite.com/Default.aspx?tag=Tag2.  Then in Page_Load you can check the query string:
string requestedTag;
if(Request.QueryString.AllKeys.Contains("tag"))
    requestedTag = Request.QueryString["tag"];

2. You can use URL re-writing - it's a bit more involved but can make the URL's a little easier to read.
0
 
LVL 2

Author Comment

by:evo_x
ID: 34083110
I want to make it with URL re-writting, I already have pages in my website with rewritten URLs, but I don't know how to implement the tags...
0
 
LVL 33

Expert Comment

by:Todd Gerbert
ID: 34083625
What tag control are you using?
0
WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

 
LVL 2

Author Comment

by:evo_x
ID: 34085282
from Telerik
0
 
LVL 33

Accepted Solution

by:
Todd Gerbert earned 500 total points
ID: 34090144
I'm still not really sure what your question is... initially you said How can I make a webpage with multiple URLs ... I don't know how to address a single webpage from multiple URLs, but then you also said  I already have pages in my website with rewritten URLs, but I don't know how to implement the tags...
So here's a an example of a page with a RadTagCloud, the items are statically defined in the <Items> element.  AutoPostBack is true for the TagCloud (so that events, like a click, fire immediately), and I've added an event handler for the TagCloud's ItemClick event.
In that event handler I get the item that was clicked and redirect the browser to the URL /CloudTags/xyz where xyz is replaced by the tag text that was clicked (for example the user might be redirected to /CloudTags/Start).
You would need to use URL re-writing to make that request go to an actual file (but you said you already have that done, so I haven't covered it here).

<%@ Page Language="C#" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

	protected void RadTagCloud1_ItemClick(object sender, RadTagCloudEventArgs e)
	{
		Response.Redirect(String.Format(
			"~/CloudTags/{0}", e.Item.Text));
	}
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
		<telerik:RadScriptManager ID="RadScriptManager1" runat="server">
		</telerik:RadScriptManager>
		<telerik:RadTagCloud ID="RadTagCloud1" runat="server" 
			onitemclick="RadTagCloud1_ItemClick" AutoPostBack="True">
			<Items>
				<telerik:RadTagCloudItem Text="ASP.NET" Weight="12" />
                <telerik:RadTagCloudItem Text="AJAX" Weight="134" />
                <telerik:RadTagCloudItem Text="VB" Weight="56" />
                <telerik:RadTagCloudItem Text="C#" Weight="38" />
                <telerik:RadTagCloudItem Text="Web" Weight="73" />
                <telerik:RadTagCloudItem Text="jQuery" Weight="23" />
                <telerik:RadTagCloudItem Text=".NET" Weight="78" />
                <telerik:RadTagCloudItem Text="Code" Weight="50" />
                <telerik:RadTagCloudItem Text="UI" Weight="80" />
                <telerik:RadTagCloudItem Text="Unit" Weight="20" />
                <telerik:RadTagCloudItem Text="Class" Weight="50" />
                <telerik:RadTagCloudItem Text="Tools" Weight="40" />
                <telerik:RadTagCloudItem Text="Dynamic" Weight="58" />
                <telerik:RadTagCloudItem Text="Telerik" Weight="60" />
                <telerik:RadTagCloudItem Text="HTTP" Weight="64" />
                <telerik:RadTagCloudItem Text="Start" Weight="62" />
                <telerik:RadTagCloudItem Text="Response" Weight="23.7" />
                <telerik:RadTagCloudItem Text="Client-side" Weight="55" />
                <telerik:RadTagCloudItem Text="Default" Weight="8.5" />
                <telerik:RadTagCloudItem Text="Event" Weight="45" />
                <telerik:RadTagCloudItem Text="Property" Weight="24" />
                <telerik:RadTagCloudItem Text="Tests" Weight="81" />
                <telerik:RadTagCloudItem Text="Method" Weight="87" />
                <telerik:RadTagCloudItem Text="DataSource" Weight="34" />
                <telerik:RadTagCloudItem Text="JavaScript" Weight="35.70" />
                <telerik:RadTagCloudItem Text="Server-side" Weight="59.3" />
                <telerik:RadTagCloudItem Text="Accessibility" Weight="15.7" />
                <telerik:RadTagCloudItem Text="HTML5" Weight="90" />
                <telerik:RadTagCloudItem Text="XHTML" Weight="47.8" />
                <telerik:RadTagCloudItem Text="Compliance" Weight="29.45" />
                <telerik:RadTagCloudItem Text="Callback" Weight="53" />
                <telerik:RadTagCloudItem Text="Request" Weight="39.3" />
                <telerik:RadTagCloudItem Text="Postback" Weight="9.5" />
                <telerik:RadTagCloudItem Text="DOM" Weight="65.49" />
                <telerik:RadTagCloudItem Text="Markup" Weight="35.49" />
                <telerik:RadTagCloudItem Text="Trigger" Weight="24.975" />
                <telerik:RadTagCloudItem Text="XML" Weight="43.975" />
                <telerik:RadTagCloudItem Text="CSS" Weight="14.392" />
                <telerik:RadTagCloudItem Text="Object" Weight="85.6" />

			</Items>
		</telerik:RadTagCloud>
    </div>
    </form>
</body>
</html>

Open in new window

0
 
LVL 2

Author Comment

by:evo_x
ID: 34091999
Thanks!
So I need a database which contains the Tags and associated Routes in order to manage the routing?
Maybe it is better with the QueryString like in your first post and then handle the routes for that?
0
 
LVL 29

Expert Comment

by:Kumaraswamy R
ID: 34280964
This question has been classified as abandoned and is being closed as part of the Cleanup Program.  See my comment at the end of the question for more details.
0

Featured Post

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Color can increase conversions, create feelings of warmth or even incite people to get behind a cause. If you want your website to really impact site visitors, then it is vital to consider the impact color has on them.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
Viewers will get an overview of the benefits and risks of using Bitcoin to accept payments. What Bitcoin is: Legality: Risks: Benefits: Which businesses are best suited?: Other things you should know: How to get started:
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question