.net radiobuttonlist add text on databind

I need to add some text to a databind.
What I have...

Dim cmd2 As New SqlCommand(strQuery2, con)
            Dim da2 As New SqlDataAdapter(cmd2)
            Dim dtRF2 As New DataTable
            da2.Fill(dtRF2)

            lst_conn2.DataSource = dtRF2
            lst_conn2.DataTextField = "display_description"
            lst_conn2.DataValueField = "value"
            lst_conn2.DataBind()

I'd like to display more than just the data on textfield...  I'm trying to do something like this...

lst_conn2.DataTextField = Here's the decription: "display_description"
sl1ngerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

pollock_dCommented:
you could always just changed your sql select to append "Description: " to the beginning of the column...

SELECT "Description: " + table1.description....
0
Bane83Commented:
You can add an ondatabinding event and add the text to each button in that event.
0
NazoUKCommented:
You can modify the items after the data has been bound to it, add this to your code behind, basically it loops through all the items in the radio list and adds extra text to the text already there:

Protected Sub lst_conn2(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst_conn2.DataBound
        For Each item As ListItem In lst_conn2.Items
            item.Text = "Here's the decription:  " & item.Text
        Next
    End Sub
0
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

sl1ngerAuthor Commented:
NazoUK -
It looks close, but I get this error??
Compiler Error Message: BC30260: 'lst_conn2' is already declared as 'Protected Dim WithEvents lst_conn2 As System.Web.UI.WebControls.RadioButtonList' in this class.
0
sl1ngerAuthor Commented:
I changed it to this.    Sub lst_conn2DataBound(ByVal sender As Object, ByVal e As RadioButtonList)

I no longer get the error, but still don't get the text.
0
NazoUKCommented:
Whoops my apologies, that code should read:

Protected Sub lst_conn2_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles lst_conn2.DataBound
        For Each item As ListItem In lst_conn2.Items
            item.Text = "Here's the decription:  " & item.Text
        Next
    End Sub

If you update this does it work?
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sl1ngerAuthor Commented:
Yes, this was very helpful.  Thank you.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.