Freetextbox.com question

  • Thread starter Thread starter Fowkester
  • Start date Start date
mark,
you have something like <FTB:FreeTextBox id="FreeTextBox1" runat="Server" />
in your aspx page.

you have a codebehind page, with the following:

PrivateSub SaveButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles SaveButton.Click
outputlabel.text = freetextbox1.text
EndSub


in other words, in your codebehind you are using the "Freetextbox1"
variable....you need to associate this variable with the <FTP:FreeTExtBox
you have in the aspx page...them sharing the same ID isn't enough....you
need to declare it in your codebehind:

protected FreeTextBox1 as FreeTextBoxControls.FreeTextBox

this links your <FTB:Freet... so the freetextbox1 variable in codebehind..

karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)
 
Hi Karl

Thanks for replying to my post, but im still having problems even though your post moved me forward.

I had forgotten to add the DLL as a referance in my project, Now I have done this and my code matchs what you suggested.

CODE BEHIND

------------

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

Dim FreeTextBox1 As FreeTextBoxControls.FreeTextBox

outputlabel.text = FreeTextBox1.Text()

End Sub

------------

SNIPS OF CODE IN FRONT

------------

<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>

<FTB:FreeTextBox id="FreeTextBox1" runat="Server" />

------------

FreeTextBox1 gives me "auto sense" so I know its registered correctley, however the .text property is blank even though there is text in the box

Any help id appricate greatly!

Regards

Mark
 
The way you've FreeTextBox1 in code-behind, it's scoped to the button_click
event...instead it must be scopped to the entire class:

public class Somehing
inherits System.Web.UI.Page

protected FreeTextBox1 as FreeTextBoxControls.FreeTextBox
Sub Page_Load
...
end sub

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
outputlabel.text = FreeTextBox1.Text()
End Sub
end class


You might want to invest some time learning asp.net more

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/ - New and Improved (yes, the popup is
annoying)
http://www.openmymind.net/faq.aspx - unofficial newsgroup FAQ (more to
come!)

Hi Karl
Thanks for replying to my post, but im still having problems even though
your post moved me forward.
I had forgotten to add the DLL as a referance in my project, Now I have done
this and my code matchs what you suggested.
CODE BEHIND
------------
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim FreeTextBox1 As FreeTextBoxControls.FreeTextBox
outputlabel.text = FreeTextBox1.Text()
End Sub
------------
SNIPS OF CODE IN FRONT
------------
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls"
Assembly="FreeTextBox" %>
<FTB:FreeTextBox id="FreeTextBox1" runat="Server" />
------------
FreeTextBox1 gives me "auto sense" so I know its registered correctley,
however the .text property is blank even though there is text in the box
Any help id appricate greatly!
Regards
Mark
 
Karl

Thanks for the help its working!! :)

Im very new to asp.net just been on my first course and im ploughing through
books.

Thanks very much for your time - you have helped me to understand!

Regards

Mark
 
Back
Top