DetailView values


I have a DetailView and I added a LinkButton to it in the footer. The detail view is binded to a datasource with a SELECT query to retrieve some values from a table. When I click my button in the DetailView, I need to access the values displayed in the current page of the DetailView and save it in string variables. How do I get those values? Should I act on DetailView object or on DataSource object or what else? This is possible to do, isn't it?

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

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.

Either use Hiddenfields, or bind the button's CommandArgument to hold the string you wish to use (and use the OnCommand event rather than the OnClick event to process things.

Something like this:
<asp:Button ID=Clicky runat=server 
    OnCommand="Clicky_Command" Text="Click Me" CommandName="ClickMe" 
    CommandArgument='<%# "FirstID:" & Eval("FirstID") & ";SecondID:" & Eval("SecondID") %>'     

Open in new window


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
Then do, maybe something like this:
Protected Sub Clicky_Command(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.CommandEventArgs)
   Dim Values() As String = e.CommandArgument.Split(";")
   For Each Value As String In Values
        Dim Pair() As String = Value.Split(":")
        '...maybe store them somewhere
   ' something
End Sub

Open in new window

ziggie301Author Commented:
Sorry I don't understand.. I don't understand vb. Maybe I dind'nt formulate my question correctly.

Is there a way to locate VALUES shown by the DetailsView component in a particular DetailsView Page?
ziggie301Author Commented:
Sorry I was in a hurry and very nervous.. This was perfect. Thank you
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
.NET Programming

From novice to tech pro — start learning today.