Solved

Telerik RadTagCloud dynamic databinding...

Posted on 2011-03-07
3
823 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
  • 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 500 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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
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.

867 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