readonly Date field

This public forum is for user-to-user discussions of ASP.NET Maker. Note that this is not support forum.
Post Reply
ahmed7
User
Posts: 97

readonly Date field

Post by ahmed7 »

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


MichaelG
User
Posts: 1095

Post by MichaelG »

You should use Client side scripts to set the field to readonly if you want to revert it later. Read:
https://aspnetmaker.dev/docs/#/fieldset ... dit-search


ahmed7
User
Posts: 97

Post by ahmed7 »

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


MichaelG
User
Posts: 1095

Post by MichaelG »

Did you remove the server side event codes?


ahmed7
User
Posts: 97

Post by ahmed7 »

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


MichaelG
User
Posts: 1095

Post by MichaelG »

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


Post Reply