We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

how to clear the value of a textbox on closing the dialogbox

how to clear the value of a textbox on closing the dialogbox
Thanks in Advance 
Regards
Thowbik


1 Reply

NP Narayanasamy Panneer Selvam Syncfusion Team September 4, 2019 10:21 AM UTC

Hi Thowfik, 
 
Greetings from Syncfusion support. 
 
Yes, you can clear text box value on closing dialog, By using dialog’s close event. On close event you can reset the textbox value by using its component instance. 
Please refer the code example in below, 

Html: 
<ejs-dialog #Dialog [header]='header' [showCloseIcon]='true' [target]='target' [width]='width' (close)="onClose()"> 
    <ng-template #content> 
        <ejs-textbox #textBox placeholder="First Name"></ejs-textbox> 
    </ng-template> 
</ejs-dialog> 
 
TS:  
@ViewChild('Dialog', null) public dialogObj: DialogComponent; 
@ViewChild('textBox', null) public textBoxObj: TextBoxComponent; 
 
. 
. 
. 
 
public onClose() { 
    this.textBoxObj.value = ""; 
} 
 
 
For your convenience we have prepared a sample, please get it from the below link, 
 
Regards, 
Narayanasamy P. 


Loader.
Live Chat Icon For mobile
Up arrow icon