We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Binding value to DropDownList ItemTemplate in GridGroupingCOntrol

Hello 
I'm new user of SyncFusion GridGroupingControl and maybe my problem stems from insufficient knowledge :-) But I still can't find solution :-(
My situation is:
I have IList<T> as a DataSource of my GGC. In aspx file I set TableDescriptor like this:

<TableDescriptor AllowEdit="false" AllowNew="false" >
                        <Columns>
                            <Syncfusion:GridColumnDescriptor Name="Imie" MappingName="Imie" HeaderText="Imie" Width="50">
                                <GroupByOptions AllowExpressionFilter="False" FilterStatusBarWidth="450" 
                                    ShowFilterStatusMessage="False" />
                            </Syncfusion:GridColumnDescriptor>
                            <Syncfusion:GridColumnDescriptor Name="Nazwisko" MappingName="Nazwisko" HeaderText="Nazwisko" Width="80">
                                <GroupByOptions AllowExpressionFilter="False" FilterStatusBarWidth="450" 
                                    ShowFilterStatusMessage="False" />
                            </Syncfusion:GridColumnDescriptor>
                            <Syncfusion:GridColumnDescriptor Name="Wiek" MappingName="Wiek" HeaderText="Wiek" Width="30">
                                <GroupByOptions AllowExpressionFilter="False" FilterStatusBarWidth="450" 
                                    ShowFilterStatusMessage="False" />
                            </Syncfusion:GridColumnDescriptor>
                            <Syncfusion:GridColumnDescriptor Name="Ilosc_H" MappingName="Ilosc_H" HeaderText="Ilość godz." Width="40">
                                <Appearance>
                                    <AnyRecordFieldCell CellType="TextBox" />
                                </Appearance>
                                <GroupByOptions AllowExpressionFilter="False" FilterStatusBarWidth="450" 
                                    ShowFilterStatusMessage="False" />
                            </Syncfusion:GridColumnDescriptor>
                            <Syncfusion:GridColumnDescriptor Name="Ilosc" MappingName="Ilosc" HeaderText="Ilość abs." Width="40">
                                <Appearance>
                                    <AnyRecordFieldCell CellType="TextBox" />
                                </Appearance>
                                <GroupByOptions AllowExpressionFilter="False" FilterStatusBarWidth="450" 
                                    ShowFilterStatusMessage="False" />
                            </Syncfusion:GridColumnDescriptor>
                            <Syncfusion:GridColumnDescriptor Name="Symbol" MappingName="Symbol" HeaderText="Powód" Width="40">
                                <ItemTemplate>
                                    <asp:DropDownList ID="DropDownList1" runat="server" 
                                        OnSelectedIndexChanged="ddl_SelectedIndexChanged" 
                                        ontextchanged="DropDownList1_TextChanged">
                                        <asp:ListItem>" "</asp:ListItem>
                                        <asp:ListItem>A</asp:ListItem>
                                        <asp:ListItem>B</asp:ListItem>
                                        <asp:ListItem>C</asp:ListItem>
                                        <asp:ListItem>D</asp:ListItem>
                                        <asp:ListItem>E</asp:ListItem>
                                    </asp:DropDownList>
                                </ItemTemplate>
                                <Appearance>
                                    <AnyRecordFieldCell CellType="ComboBox" />
                                </Appearance>
                                <GroupByOptions AllowExpressionFilter="False" FilterStatusBarWidth="450" 
                                    ShowFilterStatusMessage="False" />
                            </Syncfusion:GridColumnDescriptor>
                                                        
                        </Columns>
                     
                        <ChildGroupOptions AllowExpressionFilter="False" FilterStatusBarWidth="450" 
                            ShowFilterStatusMessage="False" />
                        <TopLevelGroupOptions AllowExpressionFilter="False" FilterStatusBarWidth="450" 
                            ShowFilterStatusMessage="False" />
                    </TableDescriptor>
I use code like in http://asp.syncfusion.com/demos/ui/gridgrouping/CRUD%20Operations/ExcelLikeEdit/cs/ExcelLikeEdit.aspx with some changes. I set Paging. When I set values in few rows and change page, all changed values remain except value of DropDownList in column Symbol. I thought that setting MappingName is sufficient to bind and save the value. What should I do to set it and do not lose it when I change page.
Plase help.
Regards
Kate.



1 Reply

RR Ranjithkumar R G Syncfusion Team March 11, 2013 04:05 AM UTC

Hi Kate,

 

Thanks for using Syncfusion products.

 

We suggest you to  handle QueryCellStyleInfo event to bind dropdown list items for Excel like Edit. Please refer to the code snippet below.

 

[CS]

 

  protected void GridGroupingControl1_QueryCellStyleInfo(object sender, GridTableCellStyleInfoEventArgs e)

    {

        if (e.TableCellIdentity.TableCellType == GridTableCellType.RecordFieldCell || e.TableCellIdentity.TableCellType == GridTableCellType.AlternateRecordFieldCell)

        {

            if (e.TableCellIdentity.Column.Name == "Title")

            {

                ArrayList array = new ArrayList();

                array.Add("Sales Representative");

                array.Add("Vice President, Sales");

                array.Add("Inside Sales Coordinator");

                array.Add("Business Manager");

                array.Add("Mail Clerk");

                array.Add("Receptionist");

                e.Style.DataSource = array;

            }

        }

    }

 

Please let us know if you have any concern.

 

Regards,

Ranjithkumar


Loader.
Live Chat Icon For mobile
Up arrow icon