Sign in | Join
Last post 11-09-2009 2:57 AM by kavita_khandhadia. 7 replies.
Sort Posts: Oldest to newest Newest to oldest
Can an ASP.NET 2.0 textbox have its text set to a combination of three XML datasource values?
For example, this textbox is in a gridview whose datasource is an XML document. Currently its text is set to one value: Text='<% #XPath("somedate/day") %>', but I'd like to set text to day + "/" + month + "/" + year. Can this be done using Eval?
Thanks!
TRY
Text='<% #XPath("somedate/day") %>', but I'd like to set text to day + "/" + month + "/" + year. text = '<%# Eval("somedate/day")%> /<%# Eval("somedate/month")%>/<%# Eval("somedate/year")%>'
dont forget mark answer if this helps
LuizFicer: text = '<%# Eval("somedate/day")%> /<%# Eval("somedate/month")%>/<%# Eval("somedate/year")%>'
text = '<%# Eval("somedate/day")%> /<%# Eval("somedate/month")%>/<%# Eval("somedate/year")%>'
Thanks, but that syntax causes a build error.
Maybe the XPath concat function is the answer, but am not sure of syntax.
text = "<%# Eval("somedate/day")%> /<%# Eval("somedate/month")%>/<%# Eval("somedate/year")%>'"
PUT THIS
text = "<%# Eval("somedate/day")%> /<%# Eval("somedate/month")%>/<%# Eval("somedate/year")%>"
I also tried the XPath concat approach recommended in the last post of this thread: http://forums.devx.com/showthread.php?threadid=166182 (/somedate/concat(day, month, year). That caused a run time error "invalid token", so I tried /somedate/concat[day, month, year] but it resulted in the same error.
Found a similar example here. Will try this and update this post with results.
http://www.tek-tips.com/viewthread.cfm?qid=1444635&page=25
there is problem in the xPath expression - somedate/concat(day, month, year
when you write concat you can write the xPath as a suffix to it
it should be something liek this
concat(somedate/day, somedate/month, somedate/year)