I want to display the textbox fields based on dropdown select

Hello!
How to display the textbox fields based on dropdown select like if I have select payment method credit card so it will require credit_card_no, CVV , etc textbox fields require, and if I select COD then address, area pin code textbox should be display

1 Reply 1 reply marked as answer

SD Saranya Dhayalan Syncfusion Team July 29, 2020 08:31 AM UTC

Hi Ishan, 
 
Thank you for contacting Syncfusion support 
 
We have checked your reported query, you can achieve this in dropdown select event. In this event you can show the textbox. Please find the below code snippet: 
 
<div> 
    @Html.EJS().DropDownButton("iconbtn").Items(ViewBag.datasource).Content("Profile").Select("select").Render() 
</div> 
<div id="txtbox" class="col-xs-6 col-sm-6 col-lg-6 col-md-6"> 
    @Html.EJS().TextBox("firstname").Placeholder("Credit card No").FloatLabelType(FloatLabelType.Auto).Render() 
</div> 
 
 
<script> 
    function select(args) { 
        if (args.item.text == "Payment method") { 
            document.getElementById("txtbox").style.display = "block"; 
        } 
    } 
 
</script> 
 
 
<style> 
    #txtbox { 
        display: none; 
    } 
    
</style> 
 
For your convenience, we have prepared a sample. Please find the below sample link 
 
 
Please check the above sample and get back to us if you need further assistance on this. 
 
Regards, 
Saranya D 


Marked as answer
Loader.
Up arrow icon