Hi,
I am creating a dynamic drop down at the run time in the webdatagrid.
In the init method, I want to bind this dropdown based on the condition with different values. the code is follows
if "(string)Session["RDId"]" is null then i want to bind "LoadDealers(Session["RDId"].ToString());" which as 10 rows otherwise i want to bind LoadDealers(""); which has 20.
but it is always displaying with 20 values.
protected void HitGrid_Init(object sender, EventArgs e) {
if ((string)Session["RDId"] != null) { string str = Session["RDId"].ToString(); Infragistics.Web.UI.GridControls.DropDownProvider dropDownProviderDealerName = new Infragistics.Web.UI.GridControls.DropDownProvider(); dropDownProviderDealerName.ID = "DropDownProvider55"; //dropDownProviderDealerName.EditorControl.DataSource = TKDAL.GetAllDealersByASMID(Session["RDId"].ToString()).DROPDOWN; //LoadDealers(_rdID); dropDownProviderDealerName.EditorControl.DataSource = LoadDealers(Session["RDId"].ToString()); dropDownProviderDealerName.EditorControl.DropDownContainerWidth = Unit.Pixel(190); dropDownProviderDealerName.EditorControl.DataKeyFields = "VALUE"; dropDownProviderDealerName.EditorControl.TextField = "NAME"; dropDownProviderDealerName.EditorControl.ValueField = "VALUE"; this.HitGrid.EditorProviders.Add(dropDownProviderDealerName); Infragistics.Web.UI.GridControls.EditingColumnSetting columnSettingDealerName = new Infragistics.Web.UI.GridControls.EditingColumnSetting(); columnSettingDealerName.ColumnKey = "Key_DEALER_ID"; columnSettingDealerName.EditorID = dropDownProviderDealerName.ID; this.HitGrid.Behaviors.EditingCore.Behaviors.CellEditing.ColumnSettings.Add(columnSettingDealerName); } else { Infragistics.Web.UI.GridControls.DropDownProvider dropDownProviderDealerNames = new Infragistics.Web.UI.GridControls.DropDownProvider(); dropDownProviderDealerNames.ID = "DropDownProvider56"; dropDownProviderDealerNames.EditorControl.DataSource = LoadDealers(""); // LoadDealers("0"); dropDownProviderDealerNames.EditorControl.DropDownContainerWidth = Unit.Pixel(190); dropDownProviderDealerNames.EditorControl.DataKeyFields = "VALUE"; dropDownProviderDealerNames.EditorControl.TextField = "NAME"; dropDownProviderDealerNames.EditorControl.ValueField = "VALUE"; this.HitGrid.EditorProviders.Add(dropDownProviderDealerNames); Infragistics.Web.UI.GridControls.EditingColumnSetting columnSettingDealerNames = new Infragistics.Web.UI.GridControls.EditingColumnSetting(); columnSettingDealerNames.ColumnKey = "Key_DEALER_ID"; columnSettingDealerNames.EditorID = dropDownProviderDealerNames.ID; this.HitGrid.Behaviors.EditingCore.Behaviors.CellEditing.ColumnSettings.Add(columnSettingDealerNames); }
}
Hey,
could you let me know if you need any additional help. Thanks,
Angel
hey,
Do you mean that Session["RDId"] is always null ? How do you add it to the session?
Thanks