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
80
put dropdownlist in only one cell of a column and not other cells
posted

Hi Folks

 every where i find code for putting dropdownlists in all the cells of a particular column

But i dont find code anywhere on this planet to make only one cell of a column have dropdownlist and other cells have no dropdown.

If anyone knows how to do it, pls reply.

thanks in advance.

Parents
  • 28464
    posted

    You can hook custom event handlers in the various events of the nested controls inside the template and hide/show/populate them based on certain criteria. In the example below. I am hiding all dropdowns with the exception of the dropdown in the third row:

    <igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" Height="200px" Width="325px"
            DataSourceID="AccessDataSource1" >
            <Bands>
                <igtbl:UltraGridBand>
                    <Columns> 
                        <igtbl:TemplatedColumn>
                            <CellTemplate>
                                <asp:DropDownList
                                    runat="server"
                                    ID="DropDownList1"
                                    OnInit="DropDownList1_OnInit">
                                </asp:DropDownList>
                            </CellTemplate>
                        </igtbl:TemplatedColumn>                 
                    </Columns>               
                </igtbl:UltraGridBand>
            </Bands>
            ...
    </igtbl:UltraWebGrid>
           
        protected void DropDownList1_OnInit(object sender, EventArgs e)
        {
            DropDownList dropDownList = sender as DropDownList;
            CellItem parentCell = (CellItem) dropDownList.NamingContainer;

            if (parentCell.Cell.Row.BandIndex != 3)
            {
                dropDownList.Visible = false;
            }       
        }

    Hope this helps.

Reply Children