Good morning
to all, I havea problem
withpassinginformationtotextAreaTextArea. From aTextBox to a
labelwhileworking
with theTextAreadoes not work. Supposethat for the
textAreathere isanother syntax.Someonecan help me? please? I give youthe code
that Iwork withtextArea
Supposethat for the
textAreathere isanother syntax.Someonecan help me? please?
As we all know, the TextArea is a html control. If you want to use it in the code behind, you need to add runat="server" in the markup. And if you want to get the value of it, please follow the demo below:
In the .aspx
<textarea id="TextArea1" cols="20" rows="2" runat="server" >
the value of textarea
</textarea>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
When I write
intextareagoing and
going,asheaded by the
labeldoes not containthe same textwritten in thetextarea. Howdo Imake surethat thelabel
carry-exactly thesame
thing I wrotein thetextarea? Thelabeldoes not mentionwhen youwrap in
textarea.
Howdo Imake surethat thelabel
carry-exactly thesame
thing I wrotein thetextarea?
You can do it using javascript. Use document.getElementById method to obtain the value of the TextArea1 at first. Then assign it to Label. Please check the demo below:
nick251988
Member
4 Points
48 Posts
Transferring page values to another page TEXTAREA
Aug 03, 2012 01:09 PM|LINK
Good morning to all,
I have a problem with passing information to textArea TextArea.
From a TextBox to a label while working with the TextArea does not work.
Suppose that for the textArea there is another syntax. Someone can help me?
please?
I give you the code that I work with textArea
thanks
protected void Button1_Click(object sender, EventArgs e)
{
Session["destinatario"] = tbdestinatario_ins.Text;
Session["attenzione"] = tbattn_ins.Text;
Session["copia"] = tbcopia_ins.Text;
Session["fax"] = tbfax_ins.Text;
Session["oggetto"] = tboggetto_ins.Text;
Session["testo"] = tatesto_ins.Text; //error
Response.Redirect("Default.aspx");
}
anhother page "Default.aspx"
protected void Page_Load(object sender, EventArgs e)
{
if (Session["destinatario"] != null)
{
lbldestinatario.Text = Session["destinatario"].ToString();
}
if (Session["copia"] != null)
{
lblcopia.Text = Session["copia"].ToString();
}
if (Session["attenzione"] != null)
{
lblattn.Text = Session["attenzione"].ToString();
}
if (Session["fax"] != null)
{
lblfax.Text = Session["fax"].ToString();
}
if (Session["oggetto"] != null)
{
lbloggetto.Text = Session["oggetto"].ToString();
}
if (Session["testo"] != null)
{
tatesto.Text = Session["testo"].ToString(); //error
}
ganesh.rane
Participant
1854 Points
318 Posts
Re: Transferring page values to another page TEXTAREA
Aug 03, 2012 01:19 PM|LINK
Can you please paste the error message ?
Ganesh Rane
Don't forget to mark useful responses as Answer if they helped you towards a solution.
nick251988
Member
4 Points
48 Posts
Re: Transferring page values to another page TEXTAREA
Aug 03, 2012 01:37 PM|LINK
Error The name 'tatesto_ins' does not exist in the current context
error The name 'tatesto' does not exist in the current context
Catherine Sh...
All-Star
23373 Points
2490 Posts
Microsoft
Re: Transferring page values to another page TEXTAREA
Aug 09, 2012 02:35 AM|LINK
Hi,
As we all know, the TextArea is a html control. If you want to use it in the code behind, you need to add runat="server" in the markup. And if you want to get the value of it, please follow the demo below:
In the .aspx
<textarea id="TextArea1" cols="20" rows="2" runat="server" > the value of textarea </textarea> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>In the .cs
protected void Page_Load(object sender, EventArgs e) { Label1.Text = TextArea1.Value; }Best wishes,
Feedback to us
Develop and promote your apps in Windows Store
nick251988
Member
4 Points
48 Posts
Re: Transferring page values to another page TEXTAREA
Aug 09, 2012 06:15 AM|LINK
hi catherine,
thanks for the answer.
It's perfect. Good job.
When I write in textarea going and going, as headed by the label does not contain the same text written in the textarea.
How do I make sure that the label carry-exactly the same thing I wrote in the textarea?
The label does not mention when you wrap in textarea.
how can I do??
Catherine Sh...
All-Star
23373 Points
2490 Posts
Microsoft
Re: Transferring page values to another page TEXTAREA
Aug 09, 2012 07:09 AM|LINK
Hi,
You can do it using javascript. Use document.getElementById method to obtain the value of the TextArea1 at first. Then assign it to Label. Please check the demo below:
<html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> function test1() { document.getElementById('Label1').innerText = document.getElementById('TextArea1').value; } </script> </head> <body> <form id="form1" runat="server"> <div> <textarea id="TextArea1" cols="20" rows="2" runat="server" onkeyup="test1()" > the value of textarea </textarea> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </div> </form> </body> </html>Best wishes,
Feedback to us
Develop and promote your apps in Windows Store