readonly Date field

hello
I use v21 and have a problem that when make some fields readonly in page render and make these fields readonly (false) in edit tag (client side events) will not back normal field for date type , I mean it will back as text box not with calendar select.

public void Page_Render() {
    //Log("Page Render");
    Field_Date.ReadOnly = true;
    
}

and in client side (edit tag)

{ // keys = event types, values = handler functions
	"change": function(e) {
		// Your code
		var $row = $(this).fields();
		$(this).fields("field_Date").visible(true);
       
        	
	}
}

I hope to get help for that
Thanks

You should use Client side scripts to set the field to readonly if you want to revert it later. Read:
https://aspnetmaker.dev/docs/#/fieldsetup.html?id=client-side-events-for-add-copy-edit-search

I did that as I showed it above.
I went in edit tag and in client side event I put that script to disable readonly:

{ // keys = event types, values = handler functions
"change": function(e) {
// Your code
var $row = $(this).fields();
$(this).fields("field_Date").readonly(false);

and that good to back my date field to enable but not back calendar selector.I hope to help me please
thanks

Did you remove the server side event codes?

No , I need there to make the field is default readonly

You should use client side Start up script to set the default, instead of Server Side codes.