|
Hi,
I have an HTML element defined as :
<textarea id="txtOrdersNotResult" runat="server" rows="5" cols="15" visible="false"></textarea>
when certain condition hold true, it triggers the textarea to be visible. Then it should set a value in this area, like
txtOrdersNotResult.Value = "this is a test"
I have also tried,
txtOrdersNotResult.InnerText = doesnotexist.ToString();
this area is empty.
any ideas?
|
|
|
|
|
You shared your requirement and not the issue you are facing while implementing it.
Now 2 things:
1. Don't use visible attribute. It will not even render the control and thus will not be accessible through JavaScript. Use style attribute 'display'
style="display:none" , set it to display:block to show.
2. to set the value in it, use attribute value (starts with small V)
txtOrdersNotResult.value = "this is a test"
Hope both the tips should be enough for you to implement it.
|
|
|
|
|
I don't think he's talking about javascript, does he?
Help people,so poeple can help you.
|
|
|
|
|
Ali Al Omairi(Abu AlHassan) wrote: he's talking about javascript, does he?
Yes, he is. See the reference of InnerText (which clearly tells it's JS)
|
|
|
|
|
|
Yep.
|
|
|
|
|
Sir;
You said:
when certain condition hold true, it triggers the textarea to be visible.
Please elaborate or show me your code.
Help people,so poeple can help you.
|
|
|
|
|
Thank you for all your help!
This web application is written in C#, I should have specified that. So, the small and big "V" would not have been an issue.
Also, "InnerText" is a property of of the textarea. Not Javascript.
Solved this problem by using an asp:Literal tag.
Thank you!
|
|
|
|
|
so, your problem was that the tag
<textarea id="TextBox1" runat="server" ></textarea>
generates an object of type HTMLGenericControl.
when the page is first loaded, the server want mention the control in the response if TextBox1.Visible is set to false, nor in the viewstate. So, when the TextBox1.Visible is set again to true on the button click request the server wont load TextBox1's properties of TextBox1 from the request so they need to be set again.
Help people,so poeple can help you.
|
|
|
|