HI all!!!
i am trying to retrieve some values from database and showing it in a gridview. When i am running the application it is giving me error on
da.fill(ds) that
Cannot call methods on text.
I searched it online but there is no information about this error.
here is the code for .aspx
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Panel ID="Panel1" runat="server" ScrollBars="Both" Width="100%">
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="4" ForeColor="#333333" GridLines="None" Width="717px"
Height="95px">
<RowStyle BackColor="#EFF3FB" />
<Columns>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%#Eval("Name")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Applied For">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%#Eval("JobTitle")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="MobileNo">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%#Eval("MobileNo")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Email-Id">
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%#Eval("Email")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Qualification">
<ItemTemplate>
<asp:Label ID="Label5" runat="server" Text='<%#Eval("ProfessionalQualification")%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Experience -Year">
<ItemTemplate>
<asp:Label ID="Label6" runat="server" Text='<%#Eval("TotlaExpYear") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Experience - Month">
<ItemTemplate>
<asp:Label ID="Label7" runat="server" Text='<%#Eval("TotalExpMonth") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Current Location">
<ItemTemplate>
<asp:Label ID="Label8" runat="server" Text='<%#Eval("CurrentLocation") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
</asp:Panel>
</asp:Content>
here is the code for .aspx.cs
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
public partial class Employer_EmployerViewResume : System.Web.UI.Page
{
SqlConnection con;
protected void Page_Load(object sender, EventArgs e)
{
if (Session["Employer"] == null )
{
Response.Redirect("EmployerLogin.aspx");
}
con = new SqlConnection(ConfigurationManager.ConnectionStrings["Constr"].ConnectionString);
con.Close();
databind();
}
private void databind()
{
con.Open();
SqlDataAdapter da = new SqlDataAdapter("Select a.Name , a.JobTitle , a.UserId , a.JobID ,a.Status,a.AppliedDate,b.MobileNo, b.Email,b.ProfessionalQualification,b.TotalExpYear.b.TotalExpMonth,b.CurrentLocation from Applied a join JobSeeker b on a.UserId= b.UserId order by a.Status DESC ,a.AppliedDate ASC", con) ;
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
}