[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

asp.net 2.0 how to reference a detailsview field in another text box

Posted on 2006-05-18
4
Medium Priority
?
564 Views
Last Modified: 2010-05-18
I used the data DetailsView control to quickly make an updateable details view.  It works great.
However I would like to referece an field that is being displayed.

I can do it wity a view: GridView2.SelectedRow.Cells.Item(1).Text
But how do I do the same with a detailsview??

0
Comment
Question by:nutrino149
2 Comments
 
LVL 11

Accepted Solution

by:
TornadoV earned 2000 total points
ID: 16712607
//each row corresponds to a BoundField on the DetailsView definition
 //Row(1) is the second field:  it renders a cell that has a
 //textbox in it.
 TextBox txt= (TextBox)DetailsView1.Rows[1].Cells[1].Controls[0];

 //if you placed your controls within ItemTemplates then you would just
 //call the FindControl with the ID you gave that control, e.g, if you
 //had placed in the markup
 //<asp:TemplateField>
 //<ItemTemplate>
 //<asp:HiddenField ID="key1" runat="server" />
 //</ItemTemplate>
 //</asp:TemplateField>
 //Then you would refer to it like this:

  HiddenField  hid= (HiddenField)detailsView1.FindControl("key1");

I founf this here:
http://forums.asp.net/thread/1264157.aspx
0
 

Author Comment

by:nutrino149
ID: 16973849
I wish to apologize, I have been away for an emergency for about a month.

Sorry about not getting back to my questions.
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Suggested Courses

829 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