asp.net - Hiding the Null Fields -


i have data repeater reading few different fields. however, information being pulled empty. hide these fields in case.

i not sure how best go this. have tried following methods:

<asp:sqldatasource id="sqldatasource1" runat="server"                  connectionstring="<%$ connectionstrings:db %>"                  selectcommand="select grname, grroom                                 [group] grname 'a%' order grname  && * not null">             </asp:sqldatasource>              <!-- output page -->             <div data-role="collapsible-set">                 <asp:repeater id="repeater1" runat="server" datasourceid="sqldatasource1">                     <itemtemplate>             <div data-role="collapsible" data-collapsed="true">                                 <p>room: <%# eval("grroom")%></p>                         </div>                     </itemtemplate>                 </asp:repeater> 

or, do in head?

    <script type="text/vbscript"> if (grroom = null)   display: none; end if </script> 

i'm not sure i'm grasping concept right now. basically, want following function run as:

"if grroom empty, not display"

any thoughts on this? appreciate insight. i'm relatively new asp , .net, i'm still learning lot.

thank time , help.

<itemtemplate>     <asp:placeholder id="placeholder1" runat="server"      visible='<%#  not [string].isnullorempty(if(typeof eval("grroom") dbnull, [string].empty, directcast(eval("grroom"), string))) %>'>         <div data-role="collapsible" data-collapsed="true">             <p>                 room:                 <%# eval("grroom")%></p>         </div>     </asp:placeholder> </itemtemplate> 


edit
didn't test @ first, i've tested code. i'm checking , empty strings. please try it.
edit 2
using c# syntax, sorry, edited vb
edit 3
added , dbnull check


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -