This is a migrated thread and some comments may be shown as answers.

Change textbox style at runtime

3 Answers 85 Views
Input
This is a migrated thread and some comments may be shown as answers.
Phaneendra
Top achievements
Rank 1
Phaneendra asked on 05 Jul 2012, 12:39 PM
Hi,
I have a Rad Textbox in the form at page load i added style of display none,
now at rad combox selection change  at client event, i have to set style display block of that textbox.

function pageLoad() {
       txt = $find("<%=txtFuelsNameSearch.ClientID  %>");
       alert(txt);
   }






Thanks in advance.


Regards
Krishna

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 05 Jul 2012, 01:20 PM
Hi Phaneendra,

Try the following Javascript to achieve your scenario.

JS:
function OnClientSelectedIndexChanged(sender, args)
 {
   var textbox = $find("<%=RadTextBox1.ClientID %>");
   textbox._element.style.display = "block";
 }

Thanks,
Princy.
0
Phaneendra
Top achievements
Rank 1
answered on 05 Jul 2012, 01:44 PM
HI Princy,

Thanks for the speedy reply.l
The above code didn't work out. 


Regards
Phaneendra
0
Princy
Top achievements
Rank 2
answered on 06 Jul 2012, 04:03 AM
Hi Phaneendra,

Unfortunately I couldn't replicate the issue. Here is the full code that I tried which works as expected at my end.

ASPX:
<telerik:RadTextBox ID="RadTextBox1" runat="server" ></telerik:RadTextBox>
  <telerik:RadComboBox ID="RadComboBox1" runat="server" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged" >
    <Items>
      ...............
    </Items>
</telerik:RadComboBox>

JS:
<script type="text/javascript">
function OnClientSelectedIndexChanged(sender, args)
 {
   var textbox = $find("<%=RadTextBox1.ClientID %>");
   textbox._element.style.display = "block";
 }
function pageLoad()
 {
   var textbox = $find("<%=RadTextBox1.ClientID %>");
   textbox._element.style.display = "none";
 }
</script>

Hope this helps.

Thanks,
Princy.
Tags
Input
Asked by
Phaneendra
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Phaneendra
Top achievements
Rank 1
Share this question
or