Skip to content
Loading
  • Santhosh Kumar Jayaraman
    0
    ok i believe you want to set the lable visibility to false.
    Try this

     <%# Eval("Mobile")%>
    0
  • 0
    thank you santhosh
    But i want to use the label text is static like
    <%# ProcessMyDataItem(Eval("Mobile")) %> 
    based on that call value from database it display or not like
    if CALL:NULL it doesn't display in gridview(with call also not display i mean static text)
    if CALL:9874563210 it bind to the gridview or display
    Please help me
    0
  • 0
    here i'm attaching .cs,aspx and output file
    0
  • Santhosh Kumar Jayaraman
    0
    have you tried my previous code?
     <%# Eval("Mobile")%>

    this should be working..I have attached a sample project in which am setting mobile property to Null . And in the visible am checking for ==null. now call label is not displayed for me.

    In your case, if your getting Dbnull, then compare with Dbnull.Value instead of null in my code.


    I attached sample project. run it and check the difference.

    0
  • 0
    it's not working i'm using framework 3.5
    0
  • Santhosh Kumar Jayaraman
    0
    You tried my project as well? i have changed it to framework 3.5 and its working.
    0
  • 0
    hi your code is working but when i'm using database it's not working
    here i'm ataching two rar files please chek it and send me the code
    0
  • Santhosh Kumar Jayaraman
    0
    Thats because from DB you might getting Dbnull


    Try this
    DBNull.Value ? false: true %>'    Text="Call :"><%# Eval("Mobile")%>
    0
  • 0
    i'm attaching my dbfile in my db it's null only so 
    please help me
    0
  • Santhosh Kumar Jayaraman
    0
    OK..In database you are saving it as "null" and not NULL. when you say "null" in varchar column, then it becomes some value and it is really not null.


    Either update your column to Null instead of 'null'

    or in label change the condition to "null" as below.


    "null" ? false: true %>'    Text="Call :"><%# Eval("Mobile")%>
    0
  • 0
                                                  Text="Call :"><%# Eval("Mobile")%>  
    it's not working in my database mobile is null and mobile datatype is
    nvarchar(255) and i changed null to NULL it is also not working
    0
  • Santhosh Kumar Jayaraman
    0
    This thread is going very long.. the same piece of code is working in my project. I cant say exact issue unless i debug the project.

    The other way is can you set Null for Mobile column instead of 'null' in database 
    update table1
    set Mobile=NULL
    where mobile='null'

    and in UI,check
     DbNull.Value?false:true
    0
  • 0
    first of all i kindly say to many thanks for your patience. still it's not working
    0
  • Dorababu Meka
    0
    Try this which works for me 



    in place of call add your database column name


    0
  • Dorababu Meka
    0
    Hi prathyusha have you tried as per said, does this works?
    0