Here i am using webdatagird with two dropdown providers. the bellow is working fine when it is edit mode, when i am using New Row adding i am not able the get first column value DropDownOpening(sender, e) { var productDropDown = $find("WebDataGrid1_ProductsDropDown" ); var grid = $find("WebDataGrid1" ); productDropDown.loadItems(grid.get_behaviors().get_activation().get_activeCell().get_row().get_cellByColumnKey('CategoryId').get_value().toString());
function
}
Hi Mr.Sai,
I have seen your posts regarding cascading dropdowns in webdatagrid, iam also working on the same i have the following senarios please help me
i have department,diciplines two dropdowns where diciplines need to load with the department selected value which i am unable to even get an idea to implement, while editing and adding a new values.
Help me with piece of code thank s in advance....
I am able to get the value after upgrading infragistics to 2010
but the dorpdown is not loaded properly
<%
@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %> <%
@ Register assembly="Infragistics35.Web.v10.1, Version=10.1.20101.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.GridControls" tagprefix="ig" %> <%
@ Register assembly="Infragistics35.Web.v10.1, Version=10.1.20101.1011, Culture=neutral, PublicKeyToken=7dd5c3163f2cd0cb" namespace="Infragistics.Web.UI.ListControls" tagprefix="ig" %>
<!
DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <
<
html xmlns
="http://www.w3.org/1999/xhtml"> <
head runat
="server">
<title></title
>
<script type="text/javascript"
CustomExitedEditMode(sender, e) {
//Gets reference to the productDropDown
var productDropDown = $find('WebDataGrid1_ProductsEditorID'
);
var grid = $find('WebDataGrid1'
); document.getElementById(
document.getElementById(
'Label1').innerText = grid.get_behaviors().get_activation().get_activeCell().get_row().get_cellByColumnKey('CategoryID'
).get_value().toString(); productDropDown.loadItems(grid.get_behaviors().get_activation().get_activeCell().get_row().get_cellByColumnKey(
productDropDown.loadItems(grid.get_behaviors().get_activation().get_activeCell().get_row().get_cellByColumnKey(
'CategoryID'
).get_value().toString()); }
</script
> </
</
head
> <
body
<form id="form1" runat
<div
<asp:ScriptManager ID="ScriptManager1" runat
</asp:ScriptManager
<ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="350px" Width="706px"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
<Columns
<ig:BoundDataField DataFieldName="CategoryID" Key
="CategoryID">
<Header Text="CategoryID"
/>
</ig:BoundDataField
<ig:BoundDataField DataFieldName="ProductID" Key
="ProductID">
<Header Text="ProductID"
<ig:BoundDataField DataFieldName="CategoryName" Key
="CategoryName">
<Header Text="CategoryName"
<ig:BoundDataField DataFieldName="ProductName" Key
="ProductName">
<Header Text="ProductName"
</Columns
<Behaviors
<ig:EditingCore
<ig:CellEditing
<ColumnSettings
<ig:EditingColumnSetting ColumnKey="CategoryID" EditorID="CategoriesDropDown"
<ig:EditingColumnSetting ColumnKey="ProductID" EditorID="ProductsDropDown"
</ColumnSettings
<EditModeActions EnableOnActive="True" EnableOnKeyPress="True"
MouseClick="Single"
</ig:CellEditing
<ig:RowAdding
<ig:RowAddingColumnSetting ColumnKey="CategoryID"
EditorID="CategoriesDropDown"
<ig:RowAddingColumnSetting ColumnKey="ProductID" EditorID="ProductsDropDown"
</ig:RowAdding
</Behaviors
</ig:EditingCore
<ig:Activation
</ig:Activation
<ig:RowSelectors
</ig:RowSelectors
<EditorProviders
<ig:DropDownProvider ID
="CategoriesDropDown">
<EditorControl DataSourceID="Categories" DropDownContainerMaxHeight="200px" runat
="server"
EnableAnimations="False" EnableDropDownAsChild="False" TextField="CategoryName"
ValueField
<Button AltText=""
<DropDownItemBinding TextField="CategoryName" ValueField="CategoryID"
</EditorControl
</ig:DropDownProvider
<ig:DropDownProvider ID="ProductsDropDown"
<EditorControl DataSourceID="Products" DropDownContainerMaxHeight="200px" runat
EnableAnimations="False" EnableDropDownAsChild="False" TextField="ProductName" OnItemsRequested
="EditorControl_ItemsRequested"
ValueField="ProductID" ID
="ProductsEditorID">
<DropDownItemBinding TextField="ProductName" ValueField="ProductID"
<ClientEvents Focus="CustomExitedEditMode"
</EditorProviders
</ig:WebDataGrid
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand
="SELECT [CategoryID], [ProductID], [CategoryName], [ProductName] FROM [Products by Category]">
</asp:SqlDataSource
<br
Selected Category ID :
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label
</div
<asp:SqlDataSource ID="Categories" runat="server"
="SELECT [CategoryID], [CategoryName] FROM [Categories]">
<asp:SqlDataSource ID="Products" runat="server"
SelectC
ommand
="SELECT [ProductID], [ProductName] FROM [Products]">
</form
html>
protected void EditorControl_ItemsRequested(object sender, Infragistics.Web.UI.ListControls.DropDownItemsRequestedEventArgs e) { DropDownProvider productProvider = (DropDownProvider)WebDataGrid1.EditorProviders[1]; productProvider.EditorControl .Items.Clear(); Products.SelectCommand = "SELECT * FROM [Products] where [CategoryID] = " + (string)e.Value; productProvider.EditorControl.DataBind (); }
protected
void EditorControl_ItemsRequested(object sender, Infragistics.Web.UI.ListControls.DropDownItemsRequestedEventArgs e) {
{
DropDownProvider productProvider = (DropDownProvider)WebDataGrid1.EditorProviders[1]; productProvider.EditorControl .Items.Clear(); Products.SelectCommand =
productProvider.EditorControl .Items.Clear();
Products.SelectCommand =
"SELECT * FROM [Products] where [CategoryID] = " + (string)e.Value; productProvider.EditorControl.DataBind (); }
productProvider.EditorControl.DataBind ();