Hi,
this is shanker am doing one project .My requirement is hierarchy of radgrid .I am doing multi hierarchy in single level hierarchy grid i have multiple detail tables in rad grid How to difference in item data bound event .this my code
if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
{
if (e.Item.OwnerTableView.DetailTableIndex == 0)
{
int? eventId = GetEventId(e.Item);
if (e.Item.OwnerTableView.IsItemInserted)
{
//item is about to be inserted
}
else
{
if (eventId.HasValue)
{
var det = studentinformation.sch_view_student_profile_detail(eventId.Value);
if (det != null)
{
TextBox txtFristname = e.Item.FindControl("txtFristname") as TextBox;
if (txtFristname != null)
{
txtFristname.Text = det.first_name;
}
TextBox txtLastName = e.Item.FindControl("txtLastName") as TextBox;
if (txtLastName != null)
{
txtLastName.Text = det.last_name;
}
TextBox txtMiddleName = e.Item.FindControl("txtMiddleName") as TextBox;
if (txtMiddleName != null)
{
txtMiddleName.Text = det.middle_name;
}
TextBox txtAdmission = e.Item.FindControl("txtAdmission") as TextBox;
if (txtAdmission != null)
{
txtAdmission.Text = det.admission_number;
}
RadioButtonList rdbgender = e.Item.FindControl("rdbgender") as RadioButtonList;
if (rdbgender != null)
{
rdbgender.SelectedValue = det.gender;
}
RadDatePicker rdp_start_date = e.Item.FindControl("rdp_start_date") as RadDatePicker;
if (rdp_start_date != null)
{
rdp_start_date.SelectedDate = det.date_of_birth;
}
RadDatePicker rdp_end_date = e.Item.FindControl("rdp_end_date") as RadDatePicker;
if (rdp_end_date != null)
{
rdp_end_date.SelectedDate = det.Admission_date;
}
CheckBox check = e.Item.FindControl("ficalyearcheck") as CheckBox;
{
if (check != null)
{
check.Checked = det.Active;
}
}
}
}
}
}
else if (e.Item.OwnerTableView.DetailTableIndex == 1)
{
int? eventId = GetEventId(e.Item);
RadComboBox Existingperson = e.Item.FindControl("Existingperson") as RadComboBox;
if (Existingperson != null)
{
Existingperson.DataSource = studentinformation.org_view_person_lookup();
Existingperson.DataBind();
}
RadComboBox Relationship = e.Item.FindControl("Relationship") as RadComboBox;
if (Relationship != null)
{
Relationship.DataSource = studentinformation.org_view_relationship_lookup();
Relationship.DataBind();
}
RadComboBox Designation = e.Item.FindControl("Designation") as RadComboBox;
if (Designation != null)
{
Designation.DataSource = studentinformation.org_view_designation_lookup();
Designation.DataBind();
}
if (e.Item.OwnerTableView.IsItemInserted)
{
//item is about to be inserted
}
else
{
if (eventId.HasValue)
{
GridEditableItem editedItem = e.Item as GridEditableItem;
int? parent_person_id = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["parent_person_id"].ToString().GetInteger();
var det = studentinformation.sch_view_student_parent_relationship_detail(eventId.Value, parent_person_id);
if (det != null)
{
if (det.parent_person_id != null)
{
Existingperson.SelectedIndex = Existingperson.Items.IndexOf(Existingperson.Items.FindItemByValue(det.parent_person_id.ToString()));
}
if (det.relationship != null)
{
Relationship.SelectedIndex = Relationship.Items.IndexOf(Relationship.Items.FindItemByText(det.relationship.ToString()));
}
if (det.designation != null)
{
Designation.SelectedIndex = Designation.Items.IndexOf(Designation.Items.FindItemByText(det.designation.ToString()));
}
TextBox txtfristname = e.Item.FindControl("txtfristname") as TextBox;
if (txtfristname != null)
{
txtfristname.Text = det.parent_first_name;
}
TextBox txtMiddlename = e.Item.FindControl("txtMiddlename") as TextBox;
if (txtMiddlename != null)
{
txtMiddlename.Text = det.parent_middle_name;
}
TextBox txtLastname = e.Item.FindControl("txtLastname") as TextBox;
if (txtLastname != null)
{
txtLastname.Text = det.parent_last_name;
}
RadDatePicker rdp_end_date = e.Item.FindControl("rdp_end_date") as RadDatePicker;
if (rdp_end_date != null)
{
rdp_end_date.SelectedDate = det.parent_date_of_birth;
}
RadioButtonList parentrdgender = e.Item.FindControl("parentrdgender") as RadioButtonList;
if (parentrdgender != null)
{
parentrdgender.SelectedValue = det.parent_gender;
}
}
}
}
}
}
how to solve that problem it's argent am struck ed my project for this problem How to solve it,s argent
shanker.B