Hello,
How can i load the items of the dropdown provider at runtime. I need it to load the current year and last year. Cliend side load is ok as well.
Thanks,
For the above post , please find the code below.
<ig:webdatagrid> <Columns><ig:BoundDataField DataFieldName="FeedTypeName" Key="FeedTypeId" Header-Text="FeedType" Width="90px"></ig:BoundDataField></Columns> <EditorProviders><ig:DropDownProvider ID="ddFeedRatioProvider"><EditorControl ID="EditorControl1" runat="server" DisplayMode="DropDown" DataSourceID="dsFeedRatioList"TextField="FeedRatioCategory"> <DropDownItemBinding ValueField="FeedRatioId"></DropDownItemBinding> </ig:webdatagrid>
<asp:ObjectDataSource runat="server" ID="dsFeedTypeNameList" SelectMethod="GetFeedTypeNameList" TypeName="Covanta.Business.EHS.FeedType"> </asp:ObjectDataSource>
When the grid loads , the FeedTypeValue is blank , although there is a value in the database. Hope this helps. Thanks.
Hi ,
I use an ObjectDataSource to get the drop down values from my drop down provider editor control and another
ObjectDataSource for the webdatagrid. So , when I update the grid , the values get saved to the database but grid drop values are not set to the updated value . Instead they are blank. I suppose the value gets over ridden by the dropdown editor control data source. So , how should I retain the value and set it on load.
I hope I was clear. Any help will be greatly appreciated.
Thanks.
I supposed that you declare it in the markup. Then the code should be something like this:
WebDataGrid1_DropDownProvider1.EditorControl.DataSourceID = "ObjectDataSource1";WebDataGrid1_DropDownProvider1.EditorControl.DataKeyFields = "CategoryID";WebDataGrid1_DropDownProvider1.EditorControl.TextField = "CategoryName";WebDataGrid1_DropDownProvider1.EditorControl.ValueField = "CategoryID";
Thank you for the answer but,
I don't want to create a new drop down provider and add it to the grid at runtime. I have a grid setup with a dropdownprovider and using an object data source. All I need is how to find that control when the grid bind to the data source and populate it with data.
Thank you,
Hello marcgh,
which editor provider you are using DropDownEditorProvider or DatePickerProvider?
If you are using DropDownProvider you can use something like this:
// Enable cell editing this.WebDataGrid1.Behaviors.CreateBehavior<EditingCore>(); this.WebDataGrid1.Behaviors.EditingCore.Behaviors.CreateBehavior<CellEditing>(); // Create an editor provider //DatePickerProvider datePickerProvider = new DatePickerProvider( ); DropDownProvider dropDownProvider = new DropDownProvider(); //Set ID and DataSource dropDownProvider.ID = "DropDownProvider1"; dropDownProvider.EditorControl.DataSourceID = "AccessDataSourceCategories"; dropDownProvider.EditorControl.DataKeyFields = "CategoryID"; dropDownProvider.EditorControl.TextField = "CategoryName"; dropDownProvider.EditorControl.ValueField = "CategoryID"; // Add to collection //this.WebDataGrid1.EditorProviders.Add(datePickerProvider); this.WebDataGrid1.EditorProviders.Add(dropDownProvider); // Create a column setting to use the editor provider EditingColumnSetting columnSetting = new EditingColumnSetting(); columnSetting.ColumnKey = "CategoryName"; // Assign editor for column to use //columnSetting.EditorID = datePickerProvider.ID; columnSetting.EditorID = dropDownProvider.ID; // Add column setting this.WebDataGrid1.Behaviors.EditingCore.Behaviors.CellEditing.ColumnSettings.Add(columnSetting);
Check this samples to see how is implement client binding in WebDropDown:http://samples.infragistics.com/aspnet/Samples/WebDropDown/Data/jQueryClientTemplates/Default.aspx?cn=drop-down&sid=1cd0d5b4-a6c5-45c2-835b-1d8b230dfb18
http://samples.infragistics.com/aspnet/Samples/WebDropDown/Data/BindingToHierarchicalJSON/Default.aspx?cn=drop-down&sid=c9dd40d1-0068-483e-88e0-d6fac427ba2a
Hope this helps