Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

How do I pull a value from a DetailsView

Posted on 2009-04-01
9
Medium Priority
?
179 Views
Last Modified: 2012-05-06
ASP.NET 2.0/VB.NET 2.0 and sql server 05: How do I pull a value from a DetailsView?
0
Comment
Question by:techpr0
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 23

Accepted Solution

by:
apresto earned 2000 total points
ID: 24039666
As in from a control or just a cell?
Cell : DetailsView1.Rows(0).Cells(1).Text
Control : DetailsView1.FindControl("ControlName").Text
0
 

Author Comment

by:techpr0
ID: 24041195
VS was telling me that DetailsView1.FindControl("ControlName") doens't have a text property. But when I watch DetailsView1.FindControl("ControlName") the value is listed as {Text="Data Im looking for"}. So what I did was:
 
Dim lbl As Label = dvCustomer.FindControl("Label1")

Then used lbl.Text to get me the value. As far as you know, is this the best way to do this?
0
 

Author Comment

by:techpr0
ID: 24041263
Is it possible to, when filling my form with these DetailsView on it,  use this DetailsView Template field to hold the value retreived from the database? Or should I just hide the DetailsView and use a textbox?
0
Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

 
LVL 23

Expert Comment

by:apresto
ID: 24041655
Sorry, in order to get the Text Property you need to convert it to TextBox:

((Textbox)DetailsView1.FindControl("ControlName")).Text
0
 
LVL 23

Expert Comment

by:apresto
ID: 24041677
Obviously change "Textbox" to the relevant Control
If you are going to use a Details View, use it to its full potential and use the TemplateField, if the DetailsView is generally unnecessary use a textbox. But if you have to hide a details view, i would suggest you dont hide it and use the templatefield
0
 

Author Comment

by:techpr0
ID: 24043232
Good, I'm on the right track. I am using a template field but how do I assign something to the template field without binding it to a datasource?
0
 
LVL 23

Expert Comment

by:apresto
ID: 24044813
Im not entirely sure what you mean, but to be honest my knowledge on this is limited, i could answer your initial question but maybe its best you start another question for this. Assuming your initial question has been answered? Did you manage to get the value from the cell?
0
 

Author Closing Comment

by:techpr0
ID: 31565321
Thanks for your help. I couldn't have done it without your helpl.
0
 
LVL 23

Expert Comment

by:apresto
ID: 24108400
Very glad that i was able to help in some way :)
Apresto
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question