Solved

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

Posted on 2010-11-07
8
591 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
  • 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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Suggested Solutions

I've been asked to discuss some of the UX activities that I'm using with my team. Here I will share some details about how we approach UX projects.
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

895 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now