Click here to Skip to main content
15,915,763 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
Below is my aspx code for detail view

<asp:DetailsView ID="DetailsView1" runat="server" Height="50px" Width="554px" AutoGenerateRows="False" BackColor="White" Visible="false" BorderColor="#336666" BorderStyle="Double" BorderWidth="3px" CellPadding="4" GridLines="Horizontal" > <pagerstyle backcolor="#336666" forecolor="White" horizontalalign="Center" /> 

<asp:TemplateField HeaderText="Company Name"> <asp:Label ID="complbl" runat = "server" text='<%# Eval("CompName")%>'> 
<asp:TemplateField HeaderText="Company Address"> <asp:Label ID="addlbl" runat="server" Visible="true" text='<%# Eval("CompAdd")%>'> 

<HeaderStyle BackColor="#336666" Font-Bold="True" ForeColor="White" /> 


When i run this code condition is becoming false
Please correct me what i have to do.

if(DetailsView1.Rows.Count != 0)
{
   Label compname = (Label)DetailsView1.Rows[1].Celles[0].FindControl("complbl");
}


Thanks
Posted

1 solution

hi
instead of use this
C#
if(DetailsView1.Rows.Count != 0)
{
   Label compname = (Label)DetailsView1.Rows[1].Celles[0].FindControl("complbl");
}



use the following

C#
if(DetailsView1.Rows.Count != 0)
{
   Label compname = (Label)DetailsView1.Rows[1].FindControl("complbl");
}
 
Share this answer
 
Comments
Lancy.net 29-Nov-11 0:42am    
Thanks for your reply ..issue not solved

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