.Net Control with button within a xslt dosen't execute the onClick function
Hi,
as the topic says. It's a basic contact form, when the user hits the button it should parse the text within the textboxes and send it via mail or, if some mandatorys textfields are left empty, it should force the user to put text in them.
Since not all pages of that type should have this kind of form i've added a True/False property and tried to make the control visible by xslt-script. It works all fine, except when you hit the Button nothing happens.
Is there something i missed, or is it just not possible?
What does the code from the user control look like? It should be possible...but maybe there is some code in the user control that prohibits it somehow?
The Page itself has 4 web user controls, which are doing basicaly the same. The users can fill out text boxes, drop down lists, check boxes, ... and when they click the buttons the page sends a email to me with the stuff they entered, choosen, clicked, whatever. 2 of the controls are called from templates and both work, 2 are called from xslt-scripts and they don't work.
So i don't think it's the code itself or the missing runat="server" attribute. But the code is on my machine at work which is off for the weekend.
Tbh i can't imagine nobody ever tried before to get a button click from a control which is loaded by a xslt-script.
You can't use server events in Macro's that get called via xslt. This is because of the inner workings of asp.net AKA the Page Lifecycle. I suggest you create a Usercontrol Macro for this situation.
Only the output of the usercontrol is rendered.. there will be no events to fire.
An option would be to place the usercontrol in a template and call the render template method from xslt... but at that point you might as well just create a usercontrol macro.
.Net Control with button within a xslt dosen't execute the onClick function
Hi,
as the topic says. It's a basic contact form, when the user hits the button it should parse the text within the textboxes and send it via mail or, if some mandatorys textfields are left empty, it should force the user to put text in them.
Since not all pages of that type should have this kind of form i've added a True/False property and tried to make the control visible by xslt-script. It works all fine, except when you hit the Button nothing happens.
Is there something i missed, or is it just not possible?
Greeting R. Niemeyer
P.S. here is the script:
Hi Niemyer
What does the code from the user control look like? It should be possible...but maybe there is some code in the user control that prohibits it somehow?
/Jan
Have you wrapped this XSLT macro in a <form runat="server"> tag? That will be needed for the postback to work.
ie
Ah yes...of course...the classic runat="server"...how could I forget to mention that one :-)
/Jan
Hi,
thx for the replies :)
The Page itself has 4 web user controls, which are doing basicaly the same. The users can fill out text boxes, drop down lists, check boxes, ... and when they click the buttons the page sends a email to me with the stuff they entered, choosen, clicked, whatever. 2 of the controls are called from templates and both work, 2 are called from xslt-scripts and they don't work.
So i don't think it's the code itself or the missing runat="server" attribute. But the code is on my machine at work which is off for the weekend.
Tbh i can't imagine nobody ever tried before to get a button click from a control which is loaded by a xslt-script.
Greets Ralph Niemeyer
Hi,
You can't use server events in Macro's that get called via xslt. This is because of the inner workings of asp.net AKA the Page Lifecycle. I suggest you create a Usercontrol Macro for this situation.
Cheers,
Richard
Only the output of the usercontrol is rendered.. there will be no events to fire.
An option would be to place the usercontrol in a template and call the render template method from xslt... but at that point you might as well just create a usercontrol macro.
is working on a reply...