TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
muthukumar
NA
0
100.9k
RowDatabound Error In Gridview Binding
Feb 4 2015 2:38 AM
DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Division'.
this is my Code For RowDataBound
if (e.Row.RowType == DataControlRowType.DataRow)
{
CheckBox chkStatus = (CheckBox)e.Row.FindControl("chkIsActive");
CheckBox chkRigid = (CheckBox)e.Row.FindControl("chkIsRigid");
HiddenField hdntitle = (HiddenField)e.Row.FindControl("hdntitle");
Label lblStatus = (Label)e.Row.FindControl("lblStatus");
Label lblRigStatus = (Label)e.Row.FindControl("lblRigStatus");
DropDownList ddlUnitHead = (DropDownList)e.Row.FindControl("ddlUnitHead");
DropDownList ddlGroup = (DropDownList)e.Row.FindControl("ddlGroup");
DropDownList ddlDivision = (DropDownList)e.Row.FindControl("ddlDivision");
Bindddl_GroupHead(ddlUnitHead);
Bindddl_Group(ddlGroup);
Bindddl_Division(ddlDivision);
if (ViewState["ViewUpdateEdit"] != null)
{
RowUpdate = new DataTable();
RowUpdate = (DataTable)ViewState["ViewUpdateEdit"];
}
else
{
BindGridView();
RowUpdate = new DataTable();
RowUpdate = (DataTable)ViewState["ViewUpdateEdit"];
}
if (RowUpdate != null && RowUpdate.Rows.Count > 0)
{
DataRow[] SelectedValues = RowUpdate.Select("ID=" + hdntitle.Value + "");
if (ddlUnitHead != null)
{
ddlUnitHead.Items.FindByValue(Convert.ToString(SelectedValues[0]["UnitHeadID"])).Selected = true;
}
if (ddlDivision != null)
{
ddlDivision.Items.FindByValue(Convert.ToString(SelectedValues[0]["DivisionID"])).Selected = true;
}
if (ddlGroup != null)
{
ddlGroup.Items.FindByValue(Convert.ToString(SelectedValues[0]["GroupID"])).Selected = true;
}
string Status = Convert.ToString(SelectedValues[0]["IsActive"]);
string Rigid = Convert.ToString(SelectedValues[0]["Rigid"]);
if (!string.IsNullOrEmpty(Status))
{
if (chkStatus != null)
{
if (Status.ToLower() == "true")
{
chkStatus.Checked = true;
}
else
{
chkStatus.Checked = false;
}
}
else
{
if (Status.ToLower() == "true")
{
lblStatus.Text = "Active";
}
else
{
lblStatus.Text = "In Active";
}
}
}
if (!string.IsNullOrEmpty(Rigid))
{
if (chkRigid != null)
{
if (Rigid.ToLower() == "true")
{
chkRigid.Checked = true;
}
else
{
chkRigid.Checked = false;
}
}
else
{
if (Rigid.ToLower() == "true")
{
lblRigStatus.Text = "Active";
}
else
{
lblRigStatus.Text = "In Active";
}
}
}
}
}
Reply
Answers (
3
)
Instance & Object
html clean up