This works perfectly and gives me exactly the data I need. However I need to do exactly the same thing from a .net user control. I can't work this out, and as usual it's probably because I am being stupid, but I'd really appreciate some help in trying to do the same thing as C#.
string formId = Request.QueryString["id"].ToString(); RecordStorage rs = new RecordStorage(); Record r = rs.GetRecord(formId); RecordsViewer viewer = new RecordsViewer(); XmlNode xml = viewer.GetSingleXmlRecord(r, new System.Xml.XmlDocument());
I've cobbled this code together from various online samples. However the error I get when I try and execute this is:
Specified cast is not valid.
This is on the line I've marked in red above.
Any samples or pointers to do this very simple thing would be much appreciated.
I just need to get all the field values in a list for the specified record.
Struggling as all the samples I'm finding seem to be much more complex than this.
What the XSLT gives me is perfect, but I can't get that into my user control. I've been thinking about it but I can't see any way to do this.
getting a record in .net
am able to retrieve a record from a contour form. In XSLT this works fine. I have the GUID of the record as query string parameter.
The XSLT is very very simple and looks like this:
This works perfectly and gives me exactly the data I need. However I need to do exactly the same thing from a .net user control. I can't work this out, and as usual it's probably because I am being stupid, but I'd really appreciate some help in trying to do the same thing as C#.
just want to check that the querystring is full? and presuming you are getting the record value.
You could do something like this..which may be closer to what you are comfortable with
http://stackoverflow.com/questions/1496850/select-xmlnode-by-id-using-xpath
thanks Ravi - yes I am definitely getting a value for the formId
lost my formatting when i posted the code snippet and when I tried to edit what i posted i got an xslt error
it is the line Record r = rs.GetRecord(formId); that is getting the error
when i set debug on this I am definitely seeing that the formId is set in the same way as the xslt version
thanks for the tip though that does look useful
so this should work?
would you say that this should return a record that i can get field data from?
aha, I just saw the following from another contour post, it may be as simple as this
where the your string should be guid. so we need to check the format of your querystring,
I got that from here:
http://our.umbraco.org/forum/umbraco-pro/contour/7163-Change-status-of-a-form-submission
trying this now :D
AHAAA that works - thank you Mr Motha
so essentially what I did wrong was passing the guid as a string and not converting into a guid type
makes sense really :)
strongly typed - don't you just love it :D
no fuss, glad to help
is working on a reply...