I am using Umbraco for a training/event registration site and running into a small issue.
I have a list of courses using XSLT (the user can click on course and see details) . I also have a simple net user control registration form (just sends a e-mail to admin) that I manually create a drop down list of all the courses on the site and the user selects the course, fills out registration information and submits. The site will have 75+ courses and I don't think its a good idea to keep adding courses manually.
I would like the nodeID information to be passed to the .net user control registration form depending on what course the user selects. I looked at the node factory api but I'm not sure on how to start. Any ideas?
If you're .net user control is on the course detail page, then you can use the umbraco.NodeFactory.Node.GetCurrent(); to get the current node. You can then use the 'node' object to get information about that particular course.
If the registration form is on a different page, then you can pass the node id of the node containing all the courses and iterate through them to fill your drop down list.
To do this in your usercontrol create a public property that's an int e.g. 'CoursesNodeId'. In the macro for your usercontrol, create a macro parameter with the same name e.g. 'CoursesNodeId'.
Thanks Nigal, Thats a good idea. I could grab the @nodeName on the net control registration page with
Request.QueryString["@nodeName"];
My concern is the course names are rather long. Is there a way to pass the @id in the quary and then use the node node factory net control to find the @nodeName or any other information related to that node?
Thanks for your reply. You are very close. The only point is I don't want a drop down list on the registration form. I'm only using a manual drop down now because I don't know which course they are intrested in (I'm typing each course in)
All the courses are on a course list template with a xslt course list macro
The registration page is a net control on its own page. Currently the two do not communicate with each other.
In that case, your best bet is to do what Nigel suggested and pass the node id in the query string. Then you can use the API as above to get the node information
Pass node information to net user control
Hello all,
I am using Umbraco for a training/event registration site and running into a small issue.
I have a list of courses using XSLT (the user can click on course and see details) . I also have a simple net user control registration form (just sends a e-mail to admin) that I manually create a drop down list of all the courses on the site and the user selects the course, fills out registration information and submits. The site will have 75+ courses and I don't think its a good idea to keep adding courses manually.
I would like the nodeID information to be passed to the .net user control registration form depending on what course the user selects. I looked at the node factory api but I'm not sure on how to start. Any ideas?
Thank you
Hi Carl
Could you have the URL's to the registration form appended with query string data ? e.g. registration.aspx?courseID=1234
Then on page load of the user control you could check for the query string data and do stuff accordingly.
Cheers
Nigel
If you're .net user control is on the course detail page, then you can use the umbraco.NodeFactory.Node.GetCurrent(); to get the current node. You can then use the 'node' object to get information about that particular course.
If the registration form is on a different page, then you can pass the node id of the node containing all the courses and iterate through them to fill your drop down list.
To do this in your usercontrol create a public property that's an int e.g. 'CoursesNodeId'. In the macro for your usercontrol, create a macro parameter with the same name e.g. 'CoursesNodeId'.
Then your code needs to do something like:
Hope that's what your after
Thanks Nigal, Thats a good idea. I could grab the @nodeName on the net control registration page with
Request.QueryString["@nodeName"];
My concern is the course names are rather long. Is there a way to pass the @id in the quary and then use the node node factory net control to find the @nodeName or any other information related to that node?
If so, this just might be what I was looking for
Thank you
This will pass the node id: Request.QueryString["@id"];
Then you can use
Node courseNode = new Node(int.Parse(Request.QueryString["id"]))
string nodeName = courseNode.Name;
Hey Euan,
Thanks for your reply. You are very close. The only point is I don't want a drop down list on the registration form. I'm only using a manual drop down now because I don't know which course they are intrested in (I'm typing each course in)
All the courses are on a course list template with a xslt course list macro
The registration page is a net control on its own page. Currently the two do not communicate with each other.
Ah, I see.
In that case, your best bet is to do what Nigel suggested and pass the node id in the query string. Then you can use the API as above to get the node information
Thanks Nigal and Euan,
I will try Nigal's solution tonight and update with the complete code to help others.
Hello, I'm running into another issue as I'm setting up my @id to pass.
Which is the best way to pass the ID using XSLT?
The registration form is located at http://somesite.com/register.aspx
The goal is for each course to pass its id so it looks like this http://somesite.com/register.aspx?course=1234 etc, etc
and I would catch the ID using Request.QueryString["id"]
I was trying something like this, but got stuck
Assuming that the page you are linking from is the relevant course node, you could use something like
<a>
<xsl:attribute name="href">
<xsl:text>/register.aspx?id=</xsl:text>
<xsl:value-of select="$currentPage/@id"/>
</xsl:attribute>
Click here to register
</a>
Thanks Euan,
Thats the tricky part...sorta. Another issue popped up. My layout looks like this
Courses ID 1234
- Course A ID 1020
- Course B ID 2010
- Course C ID 2014
When I click on "register now" on any course 1234 shows up (the parent)
Any Ideas?
Thank you in advance!
OK, I'm assuming what you're doing to display the courses is something like
<xsl:for-each select="$currentPage/courseNode">
<ul>
<li>
<xsl:value-of select="umbraco.GetXmlNodeById(@id)/@nodeName"/>
<a>
<xsl:attribute name="href">
<xsl:text>/register.aspx?id=</xsl:text>
<xsl:value-of select="@id"/>
</xsl:attribute>
Click here to register
</a>
</li>
</ul>
</xsl:for-each>
I've put the updated line in bold and red - if you are doing it the way I'm guessing this should fix your problem
Thanks for this blog post. You consistently write a intriguing post. Thanks!
is working on a reply...