Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
770
Webdatagrid - EdittorProviders not able to get the values
posted

 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

 

 

 

}

 

  • 25
    posted

    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....

  • 770
    posted

    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"

    >

     

     

     

    function

    CustomExitedEditMode(sender, e) {

     

     

     

    //Gets reference to the productDropDown

     

     

     

    var productDropDown = $find('WebDataGrid1_ProductsEditorID'

    );

     

     

    var grid = $find('WebDataGrid1'

    );

     

    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(

     

    'CategoryID'

    ).get_value().toString());

     

    }

     

     

     

     

    </script

    >

    </

     

    head

    >

    <

     

    body

    >

     

     

     

    <form id="form1" runat

    ="server">

     

     

     

    <div

    >

     

     

     

     

    <asp:ScriptManager ID="ScriptManager1" runat

    ="server">

     

     

     

    </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

    >

     

     

     

    <ig:BoundDataField DataFieldName="CategoryName" Key

    ="CategoryName">

     

     

     

    <Header Text="CategoryName"

    />

     

     

     

    </ig:BoundDataField

    >

     

     

     

    <ig:BoundDataField DataFieldName="ProductName" Key

    ="ProductName">

     

     

     

    <Header Text="ProductName"

    />

     

     

     

    </ig:BoundDataField

    >

     

     

     

    </Columns

    >

     

     

     

    <Behaviors

    >

     

     

     

    <ig:EditingCore

    >

     

     

     

    <Behaviors

    >

     

     

     

    <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

    >

     

     

     

    <ColumnSettings

    >

     

     

     

    <ig:RowAddingColumnSetting ColumnKey="CategoryID"

     

     

    EditorID="CategoriesDropDown"

    />

     

     

     

    <ig:RowAddingColumnSetting ColumnKey="ProductID" EditorID="ProductsDropDown"

    />

     

     

     

    </ColumnSettings

    >

     

     

     

    <EditModeActions EnableOnActive="True" EnableOnKeyPress="True"

     

     

    MouseClick="Single"

    />

     

     

     

    </ig:RowAdding

    >

     

     

     

     

    </Behaviors

    >

     

     

     

     

    </ig:EditingCore

    >

     

     

     

    <ig:Activation

    >

     

     

     

    </ig:Activation

    >

     

     

     

    <ig:RowSelectors

    >

     

     

     

    </ig:RowSelectors

    >

     

     

     

    </Behaviors

    >

     

     

     

    <EditorProviders

    >

     

     

     

    <ig:DropDownProvider ID

    ="CategoriesDropDown">

     

     

     

    <EditorControl DataSourceID="Categories" DropDownContainerMaxHeight="200px" runat

    ="server"

     

     

     

    EnableAnimations="False" EnableDropDownAsChild="False" TextField="CategoryName"

     

     

    ValueField

    ="CategoryID">

     

     

     

    <Button AltText=""

    />

     

     

     

    <DropDownItemBinding TextField="CategoryName" ValueField="CategoryID"

    />

     

     

     

     

    </EditorControl

    >

     

     

     

    </ig:DropDownProvider

    >

     

     

     

    <ig:DropDownProvider ID="ProductsDropDown"

    >

     

     

     

    <EditorControl DataSourceID="Products" DropDownContainerMaxHeight="200px" runat

    ="server"

     

     

     

    EnableAnimations="False" EnableDropDownAsChild="False" TextField="ProductName" OnItemsRequested

    ="EditorControl_ItemsRequested"

     

     

     

    ValueField="ProductID" ID

    ="ProductsEditorID">

     

     

     

    <Button AltText=""

    />

     

     

     

    <DropDownItemBinding TextField="ProductName" ValueField="ProductID"

    />

     

     

     

    <ClientEvents Focus="CustomExitedEditMode"

    />

     

     

     

     

    </EditorControl

    >

     

     

     

    </ig:DropDownProvider

    >

     

     

     

    </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

    />

     

     

     

    <br

    />

    Selected Category ID :

     

     

     

    <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label

    >

     

     

     

    <br

    />

     

     

     

    <br

    />

     

     

     

     

    </div

    >

     

     

     

    <asp:SqlDataSource ID="Categories" runat="server"

     

     

    ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"

     

     

    SelectCommand

    ="SELECT [CategoryID], [CategoryName] FROM [Categories]">

     

     

     

    </asp:SqlDataSource

    >

     

     

     

    <br

    />

     

     

     

    <asp:SqlDataSource ID="Products" runat="server"

     

     

    ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"

     

     

    SelectC

     

     

     

    ommand

    ="SELECT [ProductID], [ProductName] FROM [Products]">

     

     

     

    </asp:SqlDataSource

    >

     

     

     

    </form

    >

    </

     

    body

    >

    </

     

    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 ();

     

    }