Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > FormView - FindControl

Reply
Thread Tools

FormView - FindControl

 
 
topherzee topherzee is offline
Junior Member
Join Date: Sep 2008
Posts: 2
 
      09-09-2008
None of the above suggestions worked for me.
What did work was when I moved the call to the DataBound event.
In VB..

Protected Sub FormView1_DataBound(ByVal sender As Object, ByVal e As System.EventArgs)
Dim txtUserID As TextBox = FormView1.FindControl("user_idTextBox")
txtUserID.Text = 34

-topherzee
 
Reply With Quote
 
 
 
 
Magenta Magenta is offline
Junior Member
Join Date: Oct 2008
Posts: 2
 
      10-27-2008
hi
I am having a similar problem.

I am trying to pass a value from a textbox outside a formview into a textbox in the InsertItemTemplate and have been using the findcontrol...
here's my code:

TextBox test = (TextBox)FormView1.FindControl("EidTextBox");
EidTextBox.text = Textbox1.text;

Am I wrongly using FindControl. Does anyone know how to make this work?
I am very new to programming in asp.net. please help me
 
Reply With Quote
 
 
 
 
Magenta Magenta is offline
Junior Member
Join Date: Oct 2008
Posts: 2
 
      10-27-2008
Forgot to say that i am using C#
 
Reply With Quote
 
Haseeb Haseeb is offline
Junior Member
Join Date: Apr 2009
Posts: 1
 
      04-24-2009
Hi, i am having the same problem... please provide help... how do u find a control... i tried getting controls for the whole form but i can't pick up my controls in formview... i searched alot for it but couldn't find anything... Nick and Paul seems to have the answer... plz help... any one provide help
 
Reply With Quote
 
eachtour@gmail.com eachtour@gmail.com is offline
Junior Member
Join Date: Aug 2011
Posts: 1
 
      08-20-2011
Quote:
Originally Posted by deverdits View Post
I'm having the same problem but usin VB, would anyone have a solution to this in VB? I've never done anything in C# so I don't know how to even start converting it.

Much appreciated
John.
even after 3 years,nobody reply? Just do like this

<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource1">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" />
</EditItemTemplate>
</asp:FormView>


Protected Sub FormView1_PreRender(ByVal sender As Object, ByVal e As System.EventArgs) Handles FormView1.PreRender
Dim oFormView As FormView
oFormView = CType(sender, FormView)
If Not oFormView.Visible Then Exit Sub

Select Case oFormView.CurrentMode
Case FormViewMode.Edit
DIM L AS LABEL=CTYPE(FORMVIEW1.FINDCONTROL("Label1"),Label)
L.text="find u"
Case FormViewMode.ReadOnly

End Select
End Sub
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FindControl in FormView Edit Template SteveT ASP .Net 1 06-07-2007 06:47 PM
findcontrol in a formview Mr. SweatyFinger ASP .Net 0 12-01-2006 02:46 AM
Equating one formview to another ?? Dynamic type code? Findcontrol? jobs ASP .Net 0 11-07-2006 05:08 PM
Formview FindControl conversion to c# sck10 ASP .Net 2 08-28-2006 10:56 PM
FindControl in FormView Zarn Bou via DotNetMonster.com ASP .Net 0 03-16-2005 12:06 AM



Advertisments