[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 247
  • Last Modified:

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?


0
ziggie301
Asked:
ziggie301
  • 2
  • 2
1 Solution
 
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
 
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

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now