or
<
telerik:RadComboBox
ID
=
"cbbMagasin"
runat
=
"server"
Width
=
"450px"
Height
=
"150px"
ClientIDMode
=
"Static"
Filter
=
"Contains"
EmptyMessage
=
"Choisir un magasin..."
EnableLoadOnDemand
=
"True"
ShowMoreResultsBox
=
"true"
ItemsPerRequest
=
"20"
EnableVirtualScrolling
=
"true"
OnClientDropDownOpening
=
"cbbMagasin_DropDownOpening"
OnItemsRequested
=
"cbbMagasin_ItemsRequested"
LoadingMessage
=
"Chargement..."
Localization-NoMatches
=
"Aucune correspondance"
MarkFirstMatch
=
"True"
>
</
telerik:RadComboBox
>
protected
void
cbbMagasin_ItemsRequested(
object
sender, RadComboBoxItemsRequestedEventArgs e)
{
RadComboBox cbbMagasin = sender
as
RadComboBox;
cbbMagasin.Items.Clear();
var magasins = DbContext.Magasins.Where(p => p.Ville.Contains(e.Text) || p.Enseigne.Contains(e.Text) || p.CodePDV.Contains(e.Text)).OrderBy(p => p.Enseigne).ThenBy(p => p.Ville);
foreach
(Magasin m
in
magasins)
{
RadComboBoxItem item =
new
RadComboBoxItem();
item.Text = NamingHelpers.MagasinLabel(m);
item.Value = m.MagasinID.ToString();
cbbMagasin.Items.Add(item);
item.DataBind();
}
}
<
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
>
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();
}
}
}
}
}
}