This is a migrated thread and some comments may be shown as answers.

GridDetailTable problem in itemdatabound event

2 Answers 36 Views
Grid
This is a migrated thread and some comments may be shown as answers.
shanker bangari
Top achievements
Rank 1
shanker bangari asked on 24 Mar 2010, 08:34 PM
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

2 Answers, 1 is accepted

Sort by
0
Bruno
Top achievements
Rank 2
answered on 24 Mar 2010, 09:47 PM
Hi,

this is Bruno am not doing any project :)

You can use the Caption property to identify the DetailTable.

Bruno
0
shanker bangari
Top achievements
Rank 1
answered on 25 Mar 2010, 05:19 AM
Hi,

i don't know how to use caption property please send one example please it,s argent

thanks and regards
shanker.B
Tags
Grid
Asked by
shanker bangari
Top achievements
Rank 1
Answers by
Bruno
Top achievements
Rank 2
shanker bangari
Top achievements
Rank 1
Share this question
or