Hello,
I having a textbox on .ascx page. textbox is field at the time of pageload. textbox is readonly. now I want size of textbox as per the text in it. how to do this?
I use following java script:
<script type="text/javascript">
function setHeight(txtdesc) {
txtdesc.style.height = txtdesc.scrollHeight + "px";
}
</script>
for this following textbox
<asp:TextBox ID="suggText" runat="server" OnTextChanged="setHeight(this)" CommandArgument="<%#Container.DataItemIndex %>" Text='<%# DataBinder.Eval(Container.DataItem,"suggetion") %>' Font-Size="Smaller" TextMode="MultiLine" Enabled="False" OnCommand="txtSuggestion_Command" Height="20px" ReadOnly="True"></asp:TextBox>
but it gives error that
'ASP.controls_suggestions_ascx' does not contain a definition for 'setHeight' and no extension method 'setHeight' accepting a first argument of type 'ASP.controls_suggestions_ascx' could be found (are you missing a using directive or an assembly reference?)
please help
What I have tried:
I use following java script:
<script type="text/javascript">
function setHeight(txtdesc) {
txtdesc.style.height = txtdesc.scrollHeight + "px";
}
</script>
for this following textbox
<asp:TextBox ID="suggText" runat="server" OnTextChanged="setHeight(this)" CommandArgument="<%#Container.DataItemIndex %>" Text='<%# DataBinder.Eval(Container.DataItem,"suggetion") %>' Font-Size="Smaller" TextMode="MultiLine" Enabled="False" OnCommand="txtSuggestion_Command" Height="20px" ReadOnly="True"></asp:TextBox>
but it gives error that
'ASP.controls_suggestions_ascx' does not contain a definition for 'setHeight' and no extension method 'setHeight' accepting a first argument of type 'ASP.controls_suggestions_ascx' could be found (are you missing a using directive or an assembly reference?)
please help