How to access a DetailsView's ItemTemplate's TextBox in code behind? ASP.Net C# -


i have detailsview 1 of field converted templatefield able manipulate insertitemtemplate contains textbox (cf: code below). problem cannot access textbox properties in code behind... , don't :( here aspx code (portion of it):

<asp:detailsview id="_detailsview" clientidmode="static" runat="server" height="50px"         width="125px" allowpaging="true" autogeneraterows="false" datakeynames="iduniv"         datasourceid="entityds" onmodechanging="_onmodechanging">         <fields>             <asp:templatefield headertext="dateupdateuniv" sortexpression="dateupdateuniv" convertemptystringtonull="false">                 <insertitemtemplate>                     <asp:textbox id="textboxinsertitem" runat="server" text='<%# bind("dateupdateuniv") %>'></asp:textbox>                 </insertitemtemplate>                 <itemtemplate>             </asp:templatefield>             <asp:commandfield showdeletebutton="true" showeditbutton="true" showinsertbutton="true" />         </fields>     </asp:detailsview>     <asp:entitydatasource id="entityds"> 

and in page_loadcomplete event handler have this:

private void page_loadcomplete(object sender, eventargs e)     {         if (_detailsview.hascontrols())         {             control _insertdate = _detailsview.findcontrol("textboxinsertitem") textbox;             if (_insertdate != null)             {                 _insertdate.text  = "something";             }         }     } 

but following code wrong: _detailsview.findcontrol("textboxinsertitem") , doesn't work: _insertdate.text = "something";

i found interesting article, still...: http://www.devproconnections.com/article/aspnet2/getting-under-the-detailsview-control

can me find path ? how find textboxinsertitem control , interact ? thanks

 textbox txtb = _detailsview.findcontrol("textboxinsertitem") textbox;  string text = txtb.text; 

try that? apart declaring textbox instead of control cant see differences.. i've used particular way of getting data child controls alot, , it's worked me.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -