Hi,
Is this function is correct if not please guide me-
<%#Eval("Doc_IsMember").ToString() == "1" ?
Eval("Doc_Phone"):"
Eval("Doc_Phone"):"
View Contact Detail
"%> Eval('Doc_Phone')
second Eval('DOC_Phone') is not working.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Posted Feb 11, 2015, 3:01 AM
Type of conditional expression cannot be determined because there is no implicit conversion between 'object' and 'void'
keyurPosted Feb 11, 2015, 2:58 AM
You can make function too like below
Text='<%# myFormat(Eval("UnitPrice")) %>'>
Code Behind
protected string myFormat(object strArg)
{
decimal val = Convert.ToDecimal(strArg) ;
if (val == 0 )
{
return "";
}
else
{
return string.Format("{0:C}", strArg);
}
}
Hope this helps
Manish Kumar ChoudharyPosted Feb 11, 2015, 2:49 AM
in place of Server.HtmlEncode()Posted Feb 11, 2015, 2:41 AM
Manish Kumar ChoudharyPosted Feb 11, 2015, 2:33 AM
Posted Feb 11, 2015, 2:31 AM
In First solution it giving me the error as : New Line Constant
If I write that whole in one line than it is showing me whole dive as normal html code.
Is there another solution?
Manish Kumar ChoudharyPosted Feb 11, 2015, 2:23 AM
Manish Kumar ChoudharyPosted Feb 11, 2015, 2:22 AM
<%#Eval("Doc_IsMember").ToString() == "1" ?
Eval("Doc_Phone"): Server.HtmlEncode("