I am struggling with getting a user control to work in the backend.
For testing purposes, I have created a very simple user control, that updates a label with current datetime when a button is clicked. But when I click the button, nothing happens. I have inserted my usercontrol below:
How is your development setup? Are you building your control in an external web-app project, or are you writing your code, and building directly in the Umbraco website.
Either way you need to make sure that the dll, that contains the compiled code for your user control is copied to the bin folder of the site at runtime.
I tried both clearing the browsercache and I also tried republishing the site, but it didn't solve the problem. I tried adding OnClientClick to see if it is only serverside-events which are not fired or if it is also clientside-events. The clientside-events are working but not the serverside-events. Do I need to register the serverside-events somehow besides the normal "OnClick" flow? Are there any casing conventions or something else, that I should be aware of?
I've been trying to figure out this same issue as well, and finally figured out what the problem was. If you're using a default installation of 4.6.1, one of the dashboard tabs in the Content area is Change Password. The changepassword usercontrol is using field validators in order to confirm that a user enters values in the textboxes. On your simple control, when it attempts to do a postback the runtime is first processing the field validators on the Change Password tab, and preventing a postback from occuring as the textboxes are not populated.
If you comment out the Change Password tab in the dashboard.config your usercontrol will execute properly.
Cannot get simple usercontrol to work in backend
Hi,
I am struggling with getting a user control to work in the backend.
For testing purposes, I have created a very simple user control, that updates a label with current datetime when a button is clicked. But when I click the button, nothing happens. I have inserted my usercontrol below:
In my codebehind I have:
In dashboard.config I have inserted
Any help is appreciated.
Thanks
Thomas
Hi Thomas
Could you try to hardcode a text, which is displayed instead of a date maybe? Don't know if it could be something with the date formatting.
I'm thinking like setting Label1.Text ='test'; for instance.
/Jan
Hi Jan
I tried to hardcode the text, but it did not make any difference.
Btw I am on Umbraco 4.6
/Thomas
i don't think its umbraco related, i think its related to the updatepanel
Hi Thomas,
How is your development setup? Are you building your control in an external web-app project, or are you writing your code, and building directly in the Umbraco website.
Either way you need to make sure that the dll, that contains the compiled code for your user control is copied to the bin folder of the site at runtime.
Regards
Jesper Hauge
Hi
The strange thing is that the exact same usercontrol works fine in the frontend-website. It is only in the backend, it does not work.
The usercontrol is developed in the umbraco website.
thanks
Thomas
Hi Thomas
Hmmm, maybe it's caching that is the problem then - what happens if you clear it?
/Jan
Hi Jan
I tried both clearing the browsercache and I also tried republishing the site, but it didn't solve the problem. I tried adding OnClientClick to see if it is only serverside-events which are not fired or if it is also clientside-events. The clientside-events are working but not the serverside-events. Do I need to register the serverside-events somehow besides the normal "OnClick" flow? Are there any casing conventions or something else, that I should be aware of?
Thanks
Thomas
Thomas,
I've been trying to figure out this same issue as well, and finally figured out what the problem was. If you're using a default installation of 4.6.1, one of the dashboard tabs in the Content area is Change Password. The changepassword usercontrol is using field validators in order to confirm that a user enters values in the textboxes. On your simple control, when it attempts to do a postback the runtime is first processing the field validators on the Change Password tab, and preventing a postback from occuring as the textboxes are not populated.
If you comment out the Change Password tab in the dashboard.config your usercontrol will execute properly.
Andy
Hi Andy
thanks, it works. I don't think I would have figured it out myself :-)
best regards
Thomas
is working on a reply...