Change "Eval" Value


/ Published in: C#
Save to your folder(s)

You can change your dynamic binding eval text with this method.
This method should be in same codebehind


Copy this code and paste it in your HTML
  1. //Codebehind method
  2. public string ChangeValue(string val)
  3. {
  4. string ret= string.Empty;
  5.  
  6. if (val== "True")
  7. {
  8. ret= "In Stock";
  9. }
  10. else
  11. {
  12. ret= "Not in stock";
  13. }
  14.  
  15. return ret;
  16. }
  17.  
  18.  
  19.  
  20.  
  21. Replace your Eval in ASP.NET page (in example this is a label)
  22.  
  23. <asp:Label ID="Label3" runat="server" Text='<%# ChangeValue(Eval("isStock").ToString())%>'></asp:Label>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.