Click here to Skip to main content
15,113,873 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
Dear All,

I have a table as tblStudentsInfo with SId, SName, and Phone.

Now I want display SName and Phone using Repeater control.

If Phone has null values I want to disable SName column.
The expected output like,


SName Phone
----- ------
Sai 1234567890
Raju 1245678922
Alex null
Rabet null
Ramesh 1245678990
Updated 13-Dec-15 23:34pm
Amit Jadli 14-Dec-15 3:31am
You can put where clause in sql that you will not get the rows who have null values...
Sinisa Hajnal 14-Dec-15 3:43am
WHERE PHONE IS NULL. You didn't do any research and this is bad question because no attempt to solve the problem is apparent. My vote of 1.
Member 10021658 14-Dec-15 3:58am
Dear Sinisa, Thanks for your reply.
Member 10021658 14-Dec-15 4:00am
Dear Sinisa, Thanks for your reply. I have already used where condition. But I need to display SName always and disable the address if Phone is null.
SName Address Phone
Sai Bglr 1234567890
Alex (Alex don't have phone so disabled the address data)
Raju hyd 1245678990

Amit Jadli 14-Dec-15 4:09am
Not clear what u wants to do...
Arasappan 14-Dec-15 4:11am
please clearly explain
Member 10021658 14-Dec-15 4:19am
<table style="border: 1px solid #c1650f; width: 35%; padding: 10px 0px 10px 10px"
<asp:Repeater ID="Repeater2" runat="server">
<tr align="right">
<asp:Label ID="Label1" runat="server" Text='<%#Eval("SName")%>' />
<asp:Label ID="Label4" runat="server" Text='<%#Eval("Address")%>' />
<asp:Label ID="Label3" runat="server" Text='<%#Eval("Phone") %>' />


Here I want to display three columns data like SName, Address and Phone. If Student don't have phone number that row should be displayed on SName data, at same time Address and Phone numner is disabled. Thanks

1 solution

Use with and without where condition

SELECT sname,(ISNULL(phone,'disabled')) as phone,(ISNULL(address,'disabled')) as address from tablename

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900