Solved

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

Posted on 2010-11-07
8
588 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Accessibility and Usability are two concepts that seem to be closely related.  But, too many people seem to have a distorted perception of them. During last five years, those two words have come to the day-to-day work of almost every web develope…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

707 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

12 Experts available now in Live!

Get 1:1 Help Now