I am facing this error in binding of DropDownList in Grid.
I am using TableAdapter inside DataSet.xsd (DLL)
.aspx.cs code to bind DropDownList inside Grid:
GridEditableItem item = e.Item as GridEditableItem;
DropDownList rlist = item.FindControl("ddlRelationship") as DropDownList;
rlist.DataTextField = "RName";
rlist.DataValueField = "RID";
rlist.DataSource = SDM.BU.GetAllRelationship();
rlist.DataBind();
foreach (DataRow dr in _dtBU.Rows)
{
if (dr["ID"].ToString() == item.GetDataKeyValue("ID").ToString())
{
rlist.SelectedValue = dr["BURelationship"].ToString();
break;
}
}
SDM.BU class file code (BLL):
#region GET
public SDMDAL.SDM_Master_BUDataTable GetBU()
{
return Adapter.GetBU();
}
public DataTable GetAllRelationship()
{
DataTable dt = Adapter.GetRelationship();
return dt;
}
#endregion
Stored Procedure to bind the DropDownList is
ALTER PROCEDURE [dbo].[SDM_Select_Relationship]
AS
BEGIN
SET NOCOUNT ON;
SELECT distinct [RID], [RName]
FROM [SDM_DB].[dbo].[SDM_Master_Relationship](NOLOCK)
ORDER BY [RID]
END
Database Table which I am using to bind the DropDownList:
http://i.imgur.com/DVDuPmh.png
here, RfoStatusID is the foreign Key.
DataSet TableAdapter
http://i.stack.imgur.com/giew1.png
Please let me know the cause of this error and how to resolve it ? I am unable to understand why this error is coming. Whenever I click on Add New button of RadGrid, Add panel opens with this Logging Exception. Please let me know What is wrong in my code ?
NOTE: I am very new in Table Adapter method and 1st time using it.
Please reply