html - Response.Write into <%If Else%> issue -


i've code :

<td class="tr-inverse">     <div>         <%                                               if nbvetementsnonrendu <= 0                response.write(string.format("<b>{0} vêtement(s) en activité</b>", nbvetementsnonrendu))             else                response.write(string.format("<span style='font-weight:bold; color:red'>{0} vêtement(s) en activité</span>", nbvetementsnonrendu))             end if         %>    </div> 

it's works pretty perfectly. problem string write 2 times : 1 before head , 1 @ cells.

we've found solution block first writing :

<td class="tr-inverse">     <div>         <%                                               response.write(affichageresult(dldetail))         %>     </div> </td>  

and vb.net code :

public function affichageresult(byval dl datalist) string     dim retour string = string.empty     indice = indice + 1     if indice = 1        if nbvetementsnonrendu <= 0           retour = string.format("<b>{0} vêtement(s) en activité</b>", nbvetementsnonrendu)        else           retour = string.format("<span style='font-weight:bold; color:red'>{0} vêtement(s) en activité</span>", nbvetementsnonrendu)        end if     end if     return retour end function 

it's not sexy... there other way fix issue ? , why there 2 writing ?

thanks in advance.

edit

i've found solution in vb code :

if nbvetementsnonrendu <= 0       resultnbvetnrendu = string.format("<b>{0} vêtement(s) en activité</b>", nbvetementsnonrendu) else       resultnbvetnrendu = string.format("<span style='font-weight:bold; color:red'>{0} vêtement(s) en activité</span>", nbvetementsnonrendu) end if 

and in html code :

<td class="tr-inverse">     <div id="dvetnrendu" runat="server">          <%=resultnbvetnrendu%>                  </div> </td> 

and works can't understood previous behavior... if has explanation i'm interested !


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -