asp.net - No messages from my code is getting displayed. Am I doing this incorrectly? -
i have markup on formview control. formview has control id of scoregrid:
<asp:label id="percentlabel" runat="server" text='<%# eval("percentcorrect","{0:0.00}%" ) %>'
all values calculations stored in percentlabel control percentages 83.33% example.
then on codebhind, on pageload() event, have this:
dim myrow formviewrow = scoregrid.row dim lbscore label = directcast(myrow.findcontrol("percentlabel"), label) if lbscore.text < "75" message.text = "your score not meet minimum requirement" elseif lbscore.text > "75" message.text = "congratulations; have passed test" end if
based on user's scores, show user either passed test or not.
i not getting errors. however, no message getting displayed.
what doing wrong?
thank you
you comparing strings greater , less logic when need use numeric types comparison, this:
dim number single if single.tryparse(lbscore.text, number) ' comparison logic if number < 75 message.text = "your score not meet minimum requirement" elseif number >= 75 message.text = "congratulations; have passed test" end if else ' not convert text lbscore single message.text = "error trying determine score!" end if
Comments
Post a Comment