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

EditFormSettings inside RadComboBox Not Update

1 Answer 47 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
mohamed
Top achievements
Rank 1
mohamed asked on 13 Sep 2011, 01:02 PM
Hello Every One,

EditFormSettings inside RadComboBox Not Update ,
In my form EditFormSettings i have two RadComboBox first one choose that wise assign in second RadComboBox ,
In First RadComboBox that relevant values are come but not assigned in second RadComboBox,
aspx page.
<tr>
                                                    <td valign="top" align="left">
                                                        Route Name
                                                    </td>
                                                    <td>
                                                        <telerik:RadComboBox ID="combo_routname" runat="server" Width="85%" DataValueField="routecode"
                                                            DataTextField="routename" MaxLength="6" AutoPostBack="true">
                                                        </telerik:RadComboBox>
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td colspan="2" style="height: 5px;">
                                                    </td>
                                                </tr>
                                                 <tr>
                                                    <td valign="top" align="left">
                                                        Location
                                                    </td>
                                                    <td>
                                                        <telerik:RadComboBox ID="RadCombo_Location" runat="server" Width="85%"  MaxLength="6"
                                                        DataValueField="locationcode" DataTextField="locationplan" >
                                                        </telerik:RadComboBox>
                                                    </td>
                                                </tr>


.cs page  assign procedure

protected void RadGrid1_ItemCreated(object sender, Telerik.Web.UI.GridItemEventArgs e)
        {
            if (e.Item is GridEditFormItem && e.Item.IsInEditMode)
            {
                if (e.Item.OwnerTableView.IsItemInserted)
                {
                    GridEditFormItem item = (GridEditFormItem)e.Item;
                    RadComboBox serviceprovname = (RadComboBox)item.FindControl("ComboBox_servprod");
                    RadComboBox routename = (RadComboBox)item.FindControl("combo_routname");
                    RadComboBox Location = (RadComboBox)item.FindControl("RadCombo_Location");
 
 
                    using (var db = new DoskContractServicesDataContext(Globals.strCon))
                    {
                        var orgreqfinal = (from a in db.dsroutemasters
                                           where a.status != "DEL"
                                           select new { a.routecode, a.routename }).ToList();
                        routename.DataSource = orgreqfinal;
                        routename.DataValueField = "routecode";
                        routename.DataTextField = "routename";
 
                        var datamaster = (from a in db.dsdatamasters
                                          where a.status != "DEL" && a.datatype == "serpro"
                                          select new { a.clientcode, a.clientname }).ToList();
                        serviceprovname.DataSource = datamaster;
                        serviceprovname.DataValueField = "clientcode";
                        serviceprovname.DataTextField = "clientname";
 
                        if (routename.SelectedValue != "")
                        {
                            Location.Text = "";
                            Location.SelectedValue = "";
                            Location.ClearSelection();
                            Location.Items.Clear();
                            string LocationWise = ("select distinct locationcode, locationplan  from dslocationmaster where status <> 'del' and routecode = '" + routename.SelectedValue + "' ");
                            Location.DataSource = oDBClientADO.GetDataTable(LocationWise);
                            Location.DataValueField = "locationcode";
                            Location.DataTextField = "locationplan";
                            Location.DataBind();
                        }
                        else
                        {
                            string LocationWise = ("select distinct locationcode, locationplan  from dslocationmaster where status <> 'del'");
                            Location.DataSource = oDBClientADO.GetDataTable(LocationWise);
                            Location.DataValueField = "locationcode";
                            Location.DataTextField = "locationplan";
                        }
 
                    }
                }
                else
                {
                    GridEditFormItem item = (GridEditFormItem)e.Item;
                    RadComboBox serviceprod = (RadComboBox)item.FindControl("ComboBox_servprod");
                    RadComboBox routename1 = (RadComboBox)item.FindControl("combo_routname");
                    RadComboBox Location = (RadComboBox)item.FindControl("RadCombo_Location");
 
                    using (var db = new DoskContractServicesDataContext(Globals.strCon))
                    {
                        var orgreqfinal = (from a in db.dsroutemasters
                                           where a.status != "DEL"
                                           select new { a.routecode, a.routename }).ToList();
                        routename1.DataSource = orgreqfinal;
                        routename1.DataValueField = "routecode";
                        routename1.DataTextField = "routename";
 
                        var datamaster = (from a in db.dsdatamasters
                                          where a.status != "DEL" && a.datatype == "serpro"
                                          select new { a.clientcode, a.clientname }).ToList();
                        serviceprod.DataSource = datamaster;
                        serviceprod.DataValueField = "clientcode";
                        serviceprod.DataTextField = "clientname";
 
                        if (routename1.SelectedValue != "")
                        {
                            string LocationWise = ("select distinct locationcode, locationplan  from dslocationmaster where status <> 'del' and routecode = '" + routename1.SelectedValue + "' ");
                            Location.DataSource = oDBClientADO.GetDataTable(LocationWise);
                            Location.DataValueField = "locationcode";
                            Location.DataTextField = "locationplan";
                        }
                        else
                        {
                            string LocationWise = ("select distinct locationcode, locationplan  from dslocationmaster where status <> 'del'");
                            Location.DataSource = oDBClientADO.GetDataTable(LocationWise);
                            Location.DataValueField = "locationcode";
                            Location.DataTextField = "locationplan";
                        }
                    }
 
                    if (e.Item.IsInEditMode)
                    {
                        GridEditableItem editedItem = e.Item as GridEditableItem;
                        GridEditFormItem editForm = (GridEditFormItem)e.Item;
                        string serviceid = editForm["servprovcde"].Text;
 
                        if (serviceid != " ")
                        {
                            SERVICEID1 = Convert.ToInt32(serviceid);
 
                            if (SERVICEID1 > 0)
                            {
                                RadComboBox Servprd = (RadComboBox)item.FindControl("ComboBox_servprod");
                                RadComboBox Rutnam = (RadComboBox)item.FindControl("combo_routname");
                                RadComboBox lctn = (RadComboBox)item.FindControl("RadCombo_Location");
                                List<dsservicedeptnotify> service = DbClient.GetList<dsservicedeptnotify>("servprovcde = " + SERVICEID1);
                                Servprd.SelectedValue = service[0].providercode.ToString();
                                Rutnam.SelectedValue = service[0].routecode.ToString();
                                lctn.SelectedValue = service[0].location.ToString();
                            }
                        }
 
                    }
                }
            }
        }





Thanks,
Mohamed.

1 Answer, 1 is accepted

Sort by
0
Dimitar Terziev
Telerik team
answered on 15 Sep 2011, 01:31 PM
Hi Mohamed,

I'm not able to locate were exactly you are calling the DataBind method of the combo_routname combobox. As I see you are assigning data source, but the DataBind method is not called.

All the best,
Dimitar Terziev
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal
Tags
ComboBox
Asked by
mohamed
Top achievements
Rank 1
Answers by
Dimitar Terziev
Telerik team
Share this question
or