Click here to Skip to main content
15,886,199 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have bind the job list in my gridview. job title,job location,contactmail-these are fields i have bind in the gridview....If the contactmail is null or empty then apply image button must be hide for that particular job... How can i do that....

ASPX PAGE :

<asp:GridView ID="GridView1" GridLines="None" BorderStyle="None" runat="server" Width="100%" AutoGenerateColumns="False"
onpageindexchanging="GridView1_PageIndexChanging" AllowPaging="True" PageSize="20" OnRowDataBound="GridView1_RowDataBound" >
<columns>
<asp:TemplateField ControlStyle-BorderStyle="None">
<itemtemplate>


<%# Eval("Walkin_Title") %>--Exp.[<%#Eval("Exp")%>]
<%#Eval("Company_Name")%>
Skills :<%#Eval("Skills")%>




Job Location :<%# Eval("LocationName")%> <asp:ImageButton ID="ImageButton1" OnClick="ImageButton1_Click" CommandArgument='<%# Eval("WalkinID")%>' ImageUrl="~/images/apply.png" runat="server" />
<asp:Label ID="maillbl" runat="server" Text='<%# Eval("ContactMail")%>' >
<asp:Label ID="resltlbl" runat="server" Text="Label" Visible="False" CssClass="Confirm_Msg">




<pagersettings firstpagetext="" lastpagetext="">
Mode="NextPreviousFirstLast" NextPageText=""
PreviousPageText="Previous" FirstPageImageUrl="~/images/First_arrow.png"
LastPageImageUrl="~/images/Last_Arrow.png"
NextPageImageUrl="~/images/Next_arrow.png"
PreviousPageImageUrl="~/images/previous_arrow.png" />
<pagerstyle horizontalalign="Center" verticalalign="Bottom">
Posted
Updated 18-Apr-17 1:49am
v2

1 solution

Hi you can try like this,
ASP.NET
<asp:label id="maillbl" runat="server" visible='<%# Eval("ContactMail").ToString()!=""?true:false %>' text="<%# Eval("ContactMail")%>" xmlns:asp="#unknown">
</asp:label>

To hide the image button 
<asp:ImageButton ID="ImageButton1" Visible='<%# Eval("ContactMail")!=""?true:false %>' OnClick="ImageButton1_Click" CommandArgument='<%# Eval("WalkinID")%>' ImageUrl="~/images/apply.png" runat="server" />
 
Share this answer
 
v2
Comments
satyanand mishra 14-May-15 7:35am    
wow realy nice

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