Pankaj Kumar

Pankaj Kumar

  • NA
  • 112
  • 10.2k

How add css in .ashx.cs code behind in asp.net?

Jul 13 2018 1:15 AM
I want to add css class in .ashx page but .aspx Ui page show as string. How to add css in .ashx code behinde page.
 
I want (Cook) text show in red.
 
Issue:
 
 
  1. try  
  2. {  
  3. for (int i = 0; i < dsSeaech.Tables[0].Rows.Count; i++)  
  4. {  
  5. var myString = new StringBuilder();  
  6. myString.Append("<span style=\"color:red\">(Cook)</span>");  
  7. lstRecipeName.Add(dsSeaech.Tables[0].Rows[i]["RecipeName"].ToString());  
  8. if (Convert.ToInt32(dsSeaech.Tables[0].Rows[i]["UserType"]) == AppConstant.chefuser)  
  9. {  
  10. lstChefName.Add(dsSeaech.Tables[0].Rows[i]["FullName"].ToString() + "(" + "Chef" + ")");  
  11. }  
  12. else if (Convert.ToInt32(dsSeaech.Tables[0].Rows[i]["UserType"]) == AppConstant.cook)  
  13. {  
  14. lstChefName.Add(dsSeaech.Tables[0].Rows[i]["FullName"].ToString() + myString);  
  15. }  
  16. }  
  17. JavaScriptSerializer js = new JavaScriptSerializer();  
  18. context.Response.Write(js.Serialize(lstRecipeName));  
  19. }  
  20. catch (Exception ex)  
  21. {  
  22. throw ex;  
  23. }  

Answers (1)