Google Answers Logo
View Question
 
Q: ASP.NET 2.0 detailsview ( No Answer,   2 Comments )
Question  
Subject: ASP.NET 2.0 detailsview
Category: Computers > Programming
Asked by: kittykatnohome-ga
List Price: $2.00
Posted: 27 Jan 2005 09:00 PST
Expires: 10 Feb 2005 22:04 PST
Question ID: 464287
I wanted to access the textbox control "TB_firstName", but the Page is
not letting me because "TB_firstName" is embeded in the "DetailsView1"
(local varible scope i suppose).
I tried doing (TextBox)DetailsView1.findControl("TB_firstName") but
that does not let me access it either.

The reason i am using <asp:TemplateField> instead of <asp:BoundField>
because i wanted to use the <asp:RequiredFieldValidator>

Any suggestion would be appriciated.


<asp:DetailsView ID="DetailsView1" Runat="server"
    DataSourceID="ObjectDataSource2" DataKeyNames="ContactID">
 <Fields>
 <asp:TemplateField HeaderText="First Name:" >
   <ItemTemplate>
       <%#DataBinder.Eval(Container.DataItem, "FirstName")%>
   </ItemTemplate>
   <EditItemTemplate>
      <asp:TextBox ID="TB_firstName" Runat="server" MaxLength=15
         Text='<%#DataBinder.Eval(Container.DataItem, "FirstName")%>'/>
      <asp:RequiredFieldValidator ID="RFV_firstName" Runat="server"
         ControlToValidate="TB_firstName" Text="*"
         ErrorMessage="First name is required."/>
   </EditItemTemplate>
</asp:detailView>
Answer  
There is no answer at this time.

Comments  
Subject: Re: ASP.NET 2.0 detailsview
From: mattmerk2005-ga on 27 Jan 2005 14:46 PST
 
I don't have time to review this fully... but maybe this link will help:
http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=795788
Subject: Re: ASP.NET 2.0 detailsview
From: kittykatnohome-ga on 01 Feb 2005 13:12 PST
 
Sadly, that's what i suspected also.  Microsoft is such a pain sometimes.
Thank you very much for your help.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy