Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Telerik RadTagCloud dynamic databinding...

Posted on 2011-03-07
3
Medium Priority
?
836 Views
Last Modified: 2012-05-11
I have this code to fill the TagCloud control, but I don't know how can I set the NavigateUrl to a field which is not contained in database, something like ("~/Postbackpage.aspx?Make=Audi") ...for each tag there will be a different querystring for the NavigateUrlField.

protected void BindTagCloudToDataTable(RadTagCloud cloud) 
    { 
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SpecsConnectionString"].ConnectionString); 
        SqlDataAdapter adapter = new SqlDataAdapter("SELECT [Make],count(*) AS [Weight] FROM [VehicleSpecs] group by [Make] ORDER BY [Make]", con); 
        DataTable links = new DataTable(); 
        adapter.Fill(links); 
  
        cloud.DataTextField = "Make"; 
        cloud.DataWeightField = "Weight"; 
        cloud.DataNavigateUrlField = "NavigateUrl"; 
        cloud.DataSource = links; 
        cloud.DataBind(); 
    }

Open in new window

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
  • 2
3 Comments
 
LVL 2

Expert Comment

by:grossac
ID: 35062063
I haven't use the TagCloud but I would think that you can do something like this:

protected void BindTagCloudToDataTable(RadTagCloud cloud) 
    { 
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SpecsConnectionString"].ConnectionString); 
        SqlDataAdapter adapter = new SqlDataAdapter("SELECT [Make],count(*) AS [Weight] FROM [VehicleSpecs] group by [Make] ORDER BY [Make]", con); 
        DataTable links = new DataTable(); 
        adapter.Fill(links); 
  
        cloud.DataTextField = "Make"; 
        cloud.DataWeightField = "Weight"; 
        cloud.DataNavigateUrlField = "/PostBackPage.aspx?Make=" + "Make"
        cloud.DataSource = links; 
        cloud.DataBind(); 
    } 

Open in new window


With "Make" being the make text from the data adapter

Just a guess.

http://www.telerik.com/help/aspnet-ajax/tagclouddatabinding.html

0
 
LVL 2

Author Comment

by:evo_x
ID: 35062109
This does not work, I get this error:
DataBinding: 'System.Data.DataRowView' does not contain a property with the name '/PostBackPage'.
0
 
LVL 2

Accepted Solution

by:
grossac earned 2000 total points
ID: 35062334
I didn't test it before, try this...

protected void BindTagCloudToDataTable(RadTagCloud cloud) 
    { 
        SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SpecsConnectionString"].ConnectionString); 
        SqlDataAdapter adapter = new SqlDataAdapter("SELECT [Make],count(*) AS [Weight] FROM [VehicleSpecs] group by [Make] ORDER BY [Make]", con); 
        DataTable links = new DataTable(); 
        adapter.Fill(links); 
  
        cloud.DataTextField = "Make"; 
        cloud.DataWeightField = "Weight"; 
        cloud.DataSource = links; 
        cloud.DataBind(); 
    } 

            foreach (RadTagCloudItem item in cloud.Items)
            {
                item.NavigateUrl = "/PostBackPage.aspx?Make=" + item.Text;
            }

Open in new window

0

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
Without even knowing it, most of us are using web applications on a daily basis.  In fact, Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We generally confuse these web applications to…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Suggested Courses

721 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