Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post May 14, 2012 07:01 AM by Mamba Dai - MSFT
May 12, 2012 02:34 AM|LINK
Hi anyone c an help me whats wrong with my code.. Image doest display if the remarks is incorrect in my asp.net page.. check image always display even the remarks is in correct, pls help me.. heres my code, thanks
SqlCommand sc_quest = new SqlCommand("SELECT * FROM tblApplicantAnswer INNER JOIN tblQuestion ON tblApplicantAnswer.questionId = tblQuestion.questionId AND tblApplicantAnswer.categoryId = tblQuestion.categoryId WHERE tblApplicantAnswer.applicantId
='" + l_appid.Text.ToString() + "' AND tblApplicantAnswer.categoryId=" + l_catid.Text.ToString(), SqlCon);
SqlDataReader sdr_quest = sc_quest.ExecuteReader();
TableCell tc3 = new TableCell();
tc3.Width = 30;
Label l_remarks = new Label();
l_remarks.Text = sdr_quest["remarks"].ToString();
if (l_remarks.Text == "correct" )
Image i_correct = new Image();
i_correct.ImageUrl = "~/images/check.png";
Image i_incorrect = new Image();
i_incorrect.ImageUrl = "~/images/cross.png";
whats wrong with my code?
May 14, 2012 07:01 AM|LINK
Seem your source code is ok, and I suggest to comment this code line:
This Dispose method always is called after you execute this component(here is SqlCommand):
The code binding the value of path to ImageUrl property of Image control is ok, why doesn't the image be displayed? Please confirm whether the path of image is corrcect.
BTW, any error you can locate it by debuging your source code step by step and then resolve it.