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

inserting value

3 Answers 82 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Jorge Saa-Gerbier
Top achievements
Rank 1
Jorge Saa-Gerbier asked on 18 Dec 2008, 04:00 PM

Hello,
 
I have a problem and I need to do the following: with a RadComboBox (Provincias Table) I filter a RadGrid (Municipios Table), i.e., I filter the "municipios" belonging to the selected "provincia".

I need that the key selected to filter the "municipios" be a constant field when inserting a new "municipio" and that I don't have to insert it again.

Whe editing I also need to protect (to avoid incidental modification), the field that identifies the "provincia".

Please help me to solve this problem.

Thanks for your help,
Jorge Saa-Gerbier

3 Answers, 1 is accepted

Sort by
0
Veselin Vasilev
Telerik team
answered on 20 Dec 2008, 10:17 AM
Hello Jorge,

Can you please explain in more detail what the problem is?

You can also check this online example: Grid filtered by a Combo

Kind regards,
Veselin Vasilev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Jorge Saa-Gerbier
Top achievements
Rank 1
answered on 21 Dec 2008, 12:55 AM
Hello Veselin,

I have the following two tables:

[Provincias] :
  • pr_id_provincia (key)
  • pr_nombre_provincia

[Municipios] :
  • mn_id_municipio (key)
  • mn_id_provincia (foreing key)
  • mn_nombre_municpio
  • mn_CPostal
    
With the first table [Provincias] in a RadComboBox, i filter the second table [Municipios] in a RadGrid without problem, i.e. i filter 

all the "municipios" [mn_id_provincia (foreing key)] that belong to the chosen "provincia" in the RadComboBox as the online example Grid filtered by a Combo.

My problem is that I can't get to pass the field value "pr_id_provincia (key)" to the field "mn_id_provincia (foreing key)" when there's a  new added record (insert), I'm obliged to enter the field "mn_id_provincia" again, when it's the same value that already has in the field "pr_id_provincia".


Also, when editing a register, I don't know how I can protect such field ("mn_id_provincia") to avoid incidental modifications of the field.

Thanks for your help,
Jorge Saa-Gerbier
0
Princy
Top achievements
Rank 2
answered on 20 Jan 2009, 10:58 AM
Hello Jorge,

You can either set the ReadOnly proerty for that column to true so that it is not diplayed during Edit or Insert mode or you can use a TemplateColumn with a RadComboBox control in its EditItemTemplate and disable the control in EditMode or InsertMode.
aspx (ReadOnly):
<telerik:GridBoundColumn ReadOnly="true" DataField="mn_id_provincia" UniqueName="mn_id_provincia">          
</telerik:GridBoundColumn> 

aspx (Disable Control):
<telerik:GridTemplateColumn UniqueName="TemplateColumn">  
        <ItemTemplate>  
            <telerik:RadComboBox ID="RadComboBox1" DataTextField="mn_id_provincia" DataValueField="mn_id_provincia" Enabled="false" SelectedValue='<%#Eval("mn_id_provincia") %>' runat="server">  
            </telerik:RadComboBox>  
        </ItemTemplate>      
 </telerik:GridTemplateColumn>  

Thanks
Princy.
Tags
ComboBox
Asked by
Jorge Saa-Gerbier
Top achievements
Rank 1
Answers by
Veselin Vasilev
Telerik team
Jorge Saa-Gerbier
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or