This is a migrated thread and some comments may be shown as answers.

[Solved] But a default value conditionning on what has been selected in a dropdown column

1 Answer 66 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Myriam
Top achievements
Rank 1
Myriam asked on 02 Oct 2009, 06:24 PM
Hello
I have a radgrid which I can add user in the detail table. In that edit form I have a dropdownlist. On a specific selected value I would like to put a default value in the next textbox.
Here is my radgrid.
 <telerik:RadGrid   
        ID="RadGrid1"   
        runat="server" 
        DataSourceID="SQLETAB" 
        Skin="Office2007"   
        GridLines="None" 
        autogeneratecolumns="false" 
        AllowAutomaticInserts="true"   
        AllowAutomaticUpdates="True"   
        AllowAutomaticDeletes="true" 
        HorizontalAlign=left 
         EditFormSettings-FormmaintableStyle-HorizontalAlign=Left 
         Width="98%" 
        > 
          
        <PagerStyle   
            NextPageText="Suivant" PrevPageText="Précédent" Mode="NextPrevAndNumeric"   
            NextPagesToolTip="Pages suivante"   
            NextPageToolTip="Page suivante"   
            PrevPagesToolTip="Pages précédente"   
            PrevPageToolTip="Page précédente"/>  
                 <HierarchySettings ExpandTooltip="Voir les usagers pour votre Ã©tablissement" CollapseTooltip ="Revenir Ã  votre Ã©tablissement" /> 
        <MasterTableView   
            Name="MTVUsager" 
            AllowAutomaticInserts=true 
            AllowAutomaticDeletes=true 
            AllowAutomaticUpdates=true 
            DataSourceID="SQLETAB" 
            DataKeyNames="NO_ETAB" 
            CommandItemSettings-AddNewRecordText="Ajouter un Ã©tablissement"   
            CommandItemSettings-RefreshText="Rafraichir" 
            EditFormSettings-EditColumn-CancelText="Annuler"   
            EditFormSettings-EditColumn-EditText="Modifier" 
            EditFormSettings-EditColumn-UpdateText="Mise Ã  jour" 
            HorizontalAlign=Left 
            CommandItemDisplay=Top 
            EditFormSettings-FormMainTableStyle-HorizontalAlign=Left 
            EditFormSettings-FormTableItemStyle-HorizontalAlign=Left 
             EditFormSettings-FormTableAlternatingItemStyle-HorizontalAlign=Left>      
                             
              
            <ExpandCollapseColumn> 
                <HeaderStyle Width="20px" /> 
            </ExpandCollapseColumn> 
                 
            <Columns> 
              
                <telerik:GridBoundColumn   
                    SortExpression="TYPE_ECOLE"   
                    HeaderText="TYPE_ECOLE"   
                    DataField="TYPE_ECOLE"   
                    UniqueName="TYPE_ECOLE1"   
                    visible="false" 
                    readonly="true">  
                </telerik:GridBoundColumn> 
      
                      
                <telerik:GridBoundColumn   
                    SortExpression="NO_ORG"   
                    HeaderText="NO_ORG"   
                    DataField="NO_ORG"   
                    UniqueName="NO_ORG" Visible=false ReadOnly=true>  
                    <ItemStyle HorizontalAlign=Left /> 
                </telerik:GridBoundColumn> 
                  
                <telerik:GridEditCommandColumn   
                    ButtonType="ImageButton"   
                    UniqueName="EditCommandColumn" EditText="Modifier" > 
                </telerik:GridEditCommandColumn> 
                   
                 <telerik:GridButtonColumn   
                    ConfirmText="Supprimer cet Ã©tablissement?"   
                    ConfirmDialogType="RadWindow"   
                    ConfirmTitle="Supprimer"   
                    ButtonType="ImageButton" 
                    CommandName="Delete"   
                    Text="Supprimer"   
                    UniqueName="DeleteColumnEtab">  
                    <ItemStyle HorizontalAlign="Center"  /> 
                 </telerik:GridButtonColumn> 
                           
                <telerik:GridBoundColumn   
                    SortExpression="SIGLE"   
                    HeaderText="Unité administrative"   
                    DataField="SIGLE"   
                    UniqueName="SIGLE">  
                    <ItemStyle HorizontalAlign=Left /> 
                </telerik:GridBoundColumn> 
                  
                <telerik:GridBoundColumn   
                    SortExpression="DESCR"   
                    HeaderText="Nom de l'établissement"   
                    DataField="DESCR"   
                    UniqueName="DESCR">  
                    <ItemStyle HorizontalAlign=Left /> 
                </telerik:GridBoundColumn> 
            </Columns> 
            <DetailTables> 
                <telerik:GridTableView   
                    Name="DTVUSAGER" 
                    DataSourceID="SqlUSAGER" 
                    DataKeyNames="NO_IDENT" 
                    AllowAutomaticDeletes="True" 
                    AllowAutomaticInserts="true" 
                    AllowAutomaticUpdates="True" 
                    CommandItemDisplay="Bottom" 
                    CommandItemSettings-AddNewRecordText="Ajouter un usager"   
                    CommandItemSettings-RefreshText="Rafraichir"   
                    EditFormSettings-EditColumn-CancelText="Annuler"   
                    EditFormSettings-EditColumn-InsertText="Ajouter"   
                    EditFormSettings-EditColumn-EditText="Modifier"   
                    EditFormSettings-EditColumn-UpdateText="Mise Ã  jour"   
                     EditFormSettings-EditColumn-HeaderButtonType="PushButton" 
                          
                    NoDetailRecordsText="Il n'y a aucun usager pour cet Ã©tablissement."   
                    EditMode="EditForms" > 
                      
                    <ExpandCollapseColumn> 
                        <HeaderStyle Width="20px" /> 
                    </ExpandCollapseColumn> 
                  
                    <ParentTableRelation> 
                        <telerik:GridRelationFields DetailKeyField="NO_ETAB" MasterKeyField="NO_ETAB" /> 
                    </ParentTableRelation> 
                      
                    <Columns> 
                      
                         <telerik:GridTemplateColumn UniqueName="Template3" HeaderText="Confirmer">  
                            <ItemTemplate> 
                                <asp:LinkButton ID="LlGenererMotDepasse" CommandName="RegenererMotPasse" runat="server">Regénérer mot de passe</asp:LinkButton>      
                            </ItemTemplate>   
                         </telerik:GridTemplateColumn> 
                  
                         <telerik:GridEditCommandColumn   
                            ButtonType="ImageButton"   
                            UniqueName="EditCommandColumn"   
                            EditText="Modifier">  
                         </telerik:GridEditCommandColumn> 
                           
                         <telerik:GridButtonColumn   
                            ConfirmText="Supprimer cet usager?"   
                            ConfirmDialogType="RadWindow"   
                            ConfirmTitle="Supprimer"   
                            ButtonType="ImageButton" 
                            CommandName="Delete"   
                            Text="Supprimer"   
                            UniqueName="DeleteColumnDomaine">  
                            <ItemStyle HorizontalAlign="Center"  /> 
                         </telerik:GridButtonColumn> 
                      
                     <telerik:GridBoundColumn   
                            SortExpression="NO_IDENT"   
                            HeaderText="NO_IDENT"   
                            DataField="NO_IDENT"   
                            UniqueName="NO_IDENT"   
                            ReadOnly=true   
                            Visible=false>  
                        </telerik:GridBoundColumn> 
                          
                        <telerik:GridBoundColumn   
                            SortExpression="NOM"   
                            HeaderText="Nom"   
                            DataField="NOM"   
                            UniqueName="NOM">  
                        </telerik:GridBoundColumn> 
                          
                        <telerik:GridBoundColumn   
                            SortExpression="CODE_COURRIEL"   
                            HeaderText="Code de courriel"   
                            DataField="CODE_COURRIEL"   
                            UniqueName="CODE_COURRIEL">  
                        </telerik:GridBoundColumn> 
                          
                         <telerik:GridBoundColumn   
                            SortExpression="COURRIEL"   
                            HeaderText="Courriel"   
                            DataField="COURRIEL"   
                            UniqueName="COURRIEL">  
                        </telerik:GridBoundColumn> 
                          
                         
                                                
                        <telerik:GridDropDownColumn   
                            DataSourceID="XmlDSType" 
                            ListTextField="Text"   
                            ListValueField="Value" 
                            UniqueName="Type" 
                            SortExpression="Type" 
                            HeaderText="Type"   
                            DropDownControlType="RadComboBox" 
                            DataField="TYPE">  
                        </telerik:GridDropDownColumn> 
                          
                         <telerik:GridBoundColumn   
                            SortExpression="PANIER_MAX"   
                            HeaderText="Panier max"   
                            DataField="PANIER_MAX"   
                            UniqueName="PANIER_MAX">  
                        </telerik:GridBoundColumn> 
                           
                        <telerik:GridTemplateColumn EditFormHeaderTextFormat=" " HeaderText="d!" Visible=false>  
                            <EditItemTemplate> 
                                <asp:Label ID="Label1" runat=server visible=true Text="Le mot de passe de l'usager sera générer automatiquement lors d'un ajout. Celui-ci sera envoyé Ã  la personne concerné par courriel."></asp:Label> 
                            </EditItemTemplate> 
                        </telerik:GridTemplateColumn> 
                          
                    </Columns> 
                </telerik:GridTableView> 
            </DetailTables> 
        </MasterTableView> 
    </telerik:RadGrid> 

1 Answer, 1 is accepted

Sort by
0
Accepted
Yavor
Telerik team
answered on 07 Oct 2009, 07:56 AM
Hi Myriam,

You can use the selected index changed event handler of the combo, to populate the related control. This may be something similar to the approach used in this example:

http://www.telerik.com/community/code-library/aspnet-ajax/general/using-related-radcomboboxes-in-radgrid.aspx

I hope this helps.

Regards,
Yavor
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
Myriam
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Share this question
or