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
25
UltraWebGrid ValueListSelChangeHandler
posted

Hi,

How can i give a new value on a grid cell when i select item from ValueList(this is another column)

Parents
  • 28464
    posted

    Hello,

    The key here is using the client side ValueListSelChangeHandler client-side event - it gets fired whenever you are changing the selection from the dropdown for the respective column. Inside the client-side event handler you get three parametes - gridID, valueListID and cellID. You can get the dropdown instance from valueListID and get its selectedindex - and then use the client-side API of the grid to change cell values in other columns  based on the selection in the first one.

    Example:

     <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" DataSourceID="AccessDataSource1"
            Height="200px" OnInitializeLayout="UltraWebGrid1_InitializeLayout" Width="325px">
            <Bands>
                <igtbl:UltraGridBand>
                    <HeaderStyle Height="50px" />
                    <Columns>
                        <igtbl:UltraGridColumn BaseColumnName="ReorderLevel" DataType="System.Int16" IsBound="True"
                            Key="ReorderLevel" Type="DropDownList">
                            <Header Caption="ReorderLevel">
                                <RowLayoutColumnInfo OriginX="8" />
                            </Header>
                            <Footer>
                                <RowLayoutColumnInfo OriginX="8" />
                            </Footer>
                            <ValueList>
                                <ValueListItems>
                                    <igtbl:ValueListItem DisplayText="Text1" DataValue="1" />
                                    <igtbl:ValueListItem DisplayText="Text2" DataValue="1" />
                                    <igtbl:ValueListItem DisplayText="Text3" DataValue="1" />
                                </ValueListItems>
                            </ValueList>
                        </igtbl:UltraGridColumn>
                        <igtbl:UltraGridColumn BaseColumnName="Discontinued" DataType="System.Boolean" IsBound="True"
                            Key="Discontinued" Type="CheckBox">
                            <Header Caption="Discontinued">
                                <RowLayoutColumnInfo OriginX="9" />
                            </Header>
                            <Footer>
                                <RowLayoutColumnInfo OriginX="9" />
                            </Footer>
                        </igtbl:UltraGridColumn>
                    </Columns>
                    <AddNewRow View="NotSet" Visible="NotSet">
                    </AddNewRow>
                </igtbl:UltraGridBand>
            </Bands>
            <DisplayLayout BorderCollapseDefault="Separate" Name="UltraWebGrid1" RowHeightDefault="20px" AllowUpdateDefault="Yes"
                Version="4.00">
                <ClientSideEvents ValueListSelChangeHandler="cellUpdate" />
                <FrameStyle BorderStyle="Solid" BorderWidth="1px" Font-Names="Verdana" Font-Size="8pt"
                    Height="200px" Width="325px">
                </FrameStyle>
                <Pager>
                    <PagerStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
                        <BorderDetails ColorLeft="White" ColorTop="White" />
                    </PagerStyle>
                </Pager>
                <EditCellStyleDefault BorderStyle="None" BorderWidth="0px">
                </EditCellStyleDefault>
                <HeaderStyleDefault BackColor="LightGray" BorderStyle="Solid">
                    <BorderDetails ColorLeft="White" ColorTop="White" />
                </HeaderStyleDefault>
                <RowStyleDefault BackColor="White" BorderColor="Gray" BorderStyle="Solid" BorderWidth="1px"
                    Font-Names="Verdana" Font-Size="8pt">
                    <Padding Left="3px" />
                    <BorderDetails ColorLeft="White" ColorTop="White" />
                </RowStyleDefault>
                <AddNewBox>
                    <BoxStyle BackColor="LightGray" BorderStyle="Solid" BorderWidth="1px">
                        <BorderDetails ColorLeft="White" ColorTop="White" />
                    </BoxStyle>
                </AddNewBox>
                <ActivationObject BorderColor="" BorderWidth="">
                </ActivationObject>
            </DisplayLayout>
        </igtbl:UltraWebGrid>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/Nwind.mdb"
            SelectCommand="SELECT * FROM [Products]"></asp:AccessDataSource>
           
         <script type="text/javascript">

             function cellUpdate(gridID, valueListID, cellID)
             {
                 var valueList = document.getElementById(valueListID);
                 if (valueList.selectedIndex == 0) {
                     // do something.. like check checkbox
                 }
                 else {
                    // uncheck checkbox
                 }
             }
        
         </script>   

    A very good thread that can help you with CSOM and how to change values is this one:

    http://forums.infragistics.com/forums/p/1156/11700.aspx#11700

    HTH,

Reply Children
No Data