Skip to main content
added 519 characters in body
Source Link
Mathematics
  • 1.8k
  • 6
  • 28
  • 56

i have a user control, which has update panel and a button in it, when i click on button a message box appears, in messagebox i have one text box and another button,

when i click on another button, update panel triggers code behind method, now in my user control i need 2 get textbox text but no working

<asp:TextBox ID="textbox1" TextMode="MultiLine" runat="server" />

in usercontrol i am trying to ;

textbox1.text 

but it is always empty

now in button click it is this'

protected void Button1_Click(object sender, EventArgs e)
        {
string button1text = TextBox1Text;

also added this,

public partial class myUserControl : UserControl
{
    public string TextBox1Text
    {
        get 
        {
            return Page.Session["TextBox1Text"] as string;  
        }
        set
        {
            Page.Session["TextBox1Text"] = TextBox1.Text;
        }
    }

i have a user control, which has update panel and a button in it, when i click on button a message box appears, in messagebox i have one text box and another button,

when i click on another button, update panel triggers code behind method, now in my user control i need 2 get textbox text but no working

<asp:TextBox ID="textbox1" TextMode="MultiLine" runat="server" />

in usercontrol i am trying to ;

textbox1.text 

but it is always empty

i have a user control, which has update panel and a button in it, when i click on button a message box appears, in messagebox i have one text box and another button,

when i click on another button, update panel triggers code behind method, now in my user control i need 2 get textbox text but no working

<asp:TextBox ID="textbox1" TextMode="MultiLine" runat="server" />

in usercontrol i am trying to ;

textbox1.text 

but it is always empty

now in button click it is this'

protected void Button1_Click(object sender, EventArgs e)
        {
string button1text = TextBox1Text;

also added this,

public partial class myUserControl : UserControl
{
    public string TextBox1Text
    {
        get 
        {
            return Page.Session["TextBox1Text"] as string;  
        }
        set
        {
            Page.Session["TextBox1Text"] = TextBox1.Text;
        }
    }
Source Link
Mathematics
  • 1.8k
  • 6
  • 28
  • 56

textbox visual control how to get text

i have a user control, which has update panel and a button in it, when i click on button a message box appears, in messagebox i have one text box and another button,

when i click on another button, update panel triggers code behind method, now in my user control i need 2 get textbox text but no working

<asp:TextBox ID="textbox1" TextMode="MultiLine" runat="server" />

in usercontrol i am trying to ;

textbox1.text 

but it is always empty