DetailView values

Hello,

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?


ziggie301Asked:
Who is Participating?

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

x
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.

GreymanMSCCommented:
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

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
GreymanMSCCommented:
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
   Next
   '...do something
End Sub

Open in new window

0
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?
0
ziggie301Author Commented:
Sorry I was in a hurry and very nervous.. This was perfect. 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
.NET Programming

From novice to tech pro — start learning today.