protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
try
{
DataTable dt = GetList();
ddldeedno.DataSource = dt;
ddldeedno.DataTextField = "DeedNo";
ddldeedno.DataValueField = "DeedNo";
ddldeedno.DataBind();
}
catch (Exception ex)
{
ex.Message.ToString();
}
}
}
private DataTable GetList()
{
SPSite site = new SPSite(SPContext.Current.Web.Url);
SPWeb web = site.OpenWeb();
SPList list = web.Lists.TryGetList("Land General Info");
return list.Items.GetDataTable();
}
When i use that above code its throwing an exception that "DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'DeedNo'." in sharepoint But there is an attribute name as DeedNo in "Land General Info" list. I don't find out any solution. Please help me to resolve this issue.
Thanks in advance.