Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

checking if a field is not null 1

Status
Not open for further replies.

nnmmss72

Programmer
May 14, 2006
110
IR
i want to check the existance of a field in Databinder,so

<asp:Repeater id="Repeater1" runat="server">
<HeaderTemplate>
<table border=0 cellpadding=0 cellspacing=0>
</HeaderTemplate>
<ItemTemplate>
<tr><td>
<%# DataBinder.Eval(Container.DataItem,"manager")%>
<br>
phone : <%# DataBinder.Eval(Container.DataItem,"tel")%><br>
</td></tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>

how can i check if the field for tel doesnot equal to null the line
phone : <%# DataBinder.Eval(Container.DataItem,"tel")%> be writted.
i checked like "if DataBinder.Eval(Container.DataItem,"tel")!=null" but it didn't work.
how can ckeck it?
 
Why do you want to check it? If it is to replace it with something else, then you should use the ItemDataBound event.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
because suppose the records could be like this

manager: zzz
phone: 55555

or
manager: GGG
phone:

so i don't want if the phone is not entered in database the word "phone" be displayed also. so i think i should check the value of phone field if is not bull so i do the rest.
 
OK, in this case you should create a label with a Text property of "Phone". Then, in the ItemDataBound event, check if the field is Null and if it is set the Label's Visible property to False.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
now i have used Repeater, do u mean i can not do it by using Repeater, i should do that by what?
sorry i am not as professional as you, so i just get confused about ItemDataBound?

Thanks
 
Yes you can still use the Repeater - the ItemDataBound event is an event that is raised by the Repeater when an Item is bound.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top