[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

8.0

Possible to grab html attributes from linkbutton in click event?

Asked by KMPrenger in Programming for ASP.NET, .NET Framework 3.x versions, Microsoft Visual Basic.Net

Tags: ASP.net, linkbutton

Hi Everyone!  Thanks for your help!
Little info to get you started: On our website, we currently have forms and brochures pages for people to download.  (Example: https://www.mosers.org/Members/Forms.aspx).  Currently, these are written out programatically by reading a content management system (basically a database), looping through the items, writing out their values and adding <li> tags around each.  I want to add tracking to these forms so we can see usage.  I plan to write the form name, among other information to an MS SQL database.

To try and accomplish this, I'm writing these links out instead as asp linkbuttons so that when they are clicked I can raise an event to write the tracking data to the db.  Again I'm looping through the items, assigning the item's title to the linkbutton.text property.   Next is where it gets tough (at least for me!)

At first, to make the links work, I assigned the item's path (address) to the linkbuttons href attribute.  But when I do that, yes the link then works, but I get no click event.   The event never gets raised.

So then I've tried leaving the href attribute alone and just assigning the path to another attribute of the linkbutton.  For instance, Ive done " Link.Attributes.Add("title", path).  Now when the linkbutton is clicked the event is raised, but I'm stuck there because I can't grab the associated path (url) I need from the linkbutton I just clicked.   I'd like to somehow grab the title and path from whatever link I'm clicking on, but I get nothing.  Is this possible?

Here's a simple example of what I'm doing:

'Loops through links and write them out in <ol><li> tags
            output.Write("<ol>")
                If (multiselectfield Is Nothing) Then
                    'output.Write("Error finding Forms")
                Else
                    Dim items() As Sitecore.Data.Items.Item = multiselectfield.GetItems
                    If ((Not (items) Is Nothing) AndAlso (items.Length > 0)) Then
                        Dim i As Integer = 0
                        Dim path As String
                        Do While (i < items.Length)
                                path = Sitecore.Links.LinkManager.GetItemUrl(items(i))
                                output.Write("<li>")
                                        Link.Text = FieldRenderer.Render(items(i), "Title")
                                        Link.Attributes.Add("alt", path)
                                        Link.Attributes.Add("title", FieldRenderer.Render(items(i), "Title"))
                                        Link.RenderControl(output)
                                output.Write("</li>")
                            output.WriteLine()
                            i = (i + 1)
                        Loop
                    End If
                End If
            output.Write("</ol>")

'Linkbutton click event (raised from each linkbutton)
Protected Sub Link_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Link.Click
    Dim text As String
    text = Link.Attributes("title")
End Sub
 
[+][-]11/05/09 12:39 PM, ID: 25753752Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11/05/09 12:57 PM, ID: 25753927Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/06/09 02:39 AM, ID: 25757995Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: Programming for ASP.NET, .NET Framework 3.x versions, Microsoft Visual Basic.Net
Tags: ASP.net, linkbutton
Sign Up Now!
Solution Provided By: CodeCruiser
Participating Experts: 2
Solution Grade: A
 
[+][-]11/06/09 06:41 AM, ID: 25759452Author Comment

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/06/09 06:44 AM, ID: 25759480Expert Comment

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625