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
SqlCon.Open();
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);
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.
Please mark the replies as answers if they help or unmark if not.
Feedback to us
roxan
Member
116 Points
242 Posts
image doesnt display correctly?
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
SqlCon.Open();
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();
sc_quest.Dispose();
while (sdr_quest.Read())
{
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";
tc3.Controls.Add(i_correct);
}
else
{
Image i_incorrect = new Image();
i_incorrect.ImageUrl = "~/images/cross.png";
tc3.Controls.Add(i_incorrect);
}
tr.Cells.Add(tc3);
tbldynamic.Rows.Add(tr);
p_result.Controls.Add(tbldynamic);
}
whats wrong with my code?
Mamba Dai - ...
All-Star
23530 Points
2683 Posts
Microsoft
Re: image doesnt display correctly?
May 14, 2012 07:01 AM|LINK
Hi,
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):
http://msdn.microsoft.com/en-us/library/3cc9y48w
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.
Feedback to us
Develop and promote your apps in Windows Store