How to append static text to a bound field? [modified]
-
I am trying to append static text to a bound field in the range validator ErrorMessage field. The code below works fine but as soon as I try to append any static text it either throws an error or just displays the static text. Any help would be appreicated.
Lost in the vast sea of .NET
modified on Wednesday, June 17, 2009 7:50 AM
-
I am trying to append static text to a bound field in the range validator ErrorMessage field. The code below works fine but as soon as I try to append any static text it either throws an error or just displays the static text. Any help would be appreicated.
Lost in the vast sea of .NET
modified on Wednesday, June 17, 2009 7:50 AM
KreativeKai wrote:
ErrorMessage='<%# Bind("item_short_desc")%>'
ErrorMessage='This is an error, it is described as : <%# Bind("item_short_desc")%>' should work. Or ErrorMessage='<%=string.Format("This is an error, it is {0}", Bind("item_short_desc"))%>' should also work. Bind, is that right ? I thought it was Eval ?
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
-
KreativeKai wrote:
ErrorMessage='<%# Bind("item_short_desc")%>'
ErrorMessage='This is an error, it is described as : <%# Bind("item_short_desc")%>' should work. Or ErrorMessage='<%=string.Format("This is an error, it is {0}", Bind("item_short_desc"))%>' should also work. Bind, is that right ? I thought it was Eval ?
Christian Graus Driven to the arms of OSX by Vista. "! i don't exactly like or do programming and it only gives me a headache." - spotted in VB forums. I can do things with my brain that I can't even google. I can flex the front part of my brain instantly anytime I want. It can be exhausting and it even causes me vision problems for some reason. - CaptainSeeSharp
Hi Christian, I wasn’t able to get your first suggestion to work but I was able to get your second suggestion to work. You were correct it didn’t work with Bind I needed to substitute for eval. I am not sure why because if you don’t want to append any text bind works just fine. This is the code I ended up using:
ErrorMessage='<%# string.Format("Invalid Qty for {0}", eval("item_short_desc")) %>
Thanks for you assistance.
Lost in the vast sea of .NET