User-587451972 posted
Hi,
I need help with respect to show image with text in .chtml . Like:- SubjectName[Tick
]
I am getting data in a @Model.Student.Subject, which have string data in 'Pass[1], Fail[0]' where [1] =Tick Image with title "", [0]= Cross image with title "".
My requirement is to show student subject result with image. I tried to append text with image, but its not helping me out.
Below sample code is C# used in .chtml.
//Model.Student.Subject= "Physics[1],Chemistry[0],Maths[1],Biology[1]"
string[] arrSubject = Model.Student.Subject.Split(new[] { ',' });
var studentSubjectResult= new System.Text.StringBuilder();
foreach (var item in arrSubject )
{
//if student subject contain[1]
if (item.Contains("[1]")){
//then show subject name with tick image and image title "pass"
var subjectName = item.Split('[')[0];
studentSubjectResult.Append(subject+ <img src="" title="Pass"> )
}
else{
var subjectName = item.Split('[')[0];
//then show subject name with tick image and image title "Fail"
studentSubjectResult.Append(subjectName+ <img src="" title="Fail"> );
}
How i can show the result, text with image using C# in .chtml (view page).
Thanks in advance.