?
Solved

How do I pull a value from a DetailsView

Posted on 2009-04-01
9
Medium Priority
?
178 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
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.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

762 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