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

problem with rule in a dropdowncolumn

3 Answers 54 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Daniel
Top achievements
Rank 1
Daniel asked on 19 Sep 2008, 08:31 PM
Hi all,

I have a RadGrid with diferent bound columns that represents one table of my DB and i use an user control to edit the registers and add new ones.

The problem is that one of the columns in the table has a rule and only accepts the values 'L' or 'O' (Local or Other) and when i charge the info on the grid, in that column it shows the value 'L' or 'O' and i want it to show 'Local' or 'Other'. So i decided to create an XML file that contains all the rules with their respective text and values

<?xml version="1.0" encoding="utf-8" ?> 
<root> 
    <tipoComprobante_CHK> 
        <Item Text="Local" Value="L" /> 
        <Item Text="Casa Matriz" Value="M" /> 
        <Item Text="Ambos" Value="A" /> 
    </tipoComprobante_CHK> 
    <OtherRule_CHK> 
        <Item Text="Local" Value="L" /> 
        <Item Text="Other" Value="O" /> 
    </OtherRule_CHK> 
</root> 
 


According to this i supossed that i need to change a BoundColumn for a telerik:DropDownColumn, but i dont know how to put the info of one rule (XML) in the new column and how to declare the value that the column need to shows.

<telerik:GridBoundColumn DataField="TipoComprobante" HeaderText="Tipo Comprobante" SortExpression="TipoComprobante" UniqueName="TipoComprobante" /> ...  works for the bound column               
 


Also in the User Control when i want to edit a register and it has a FK to other table i declare a RadCombo and get the selected value really simple:

<telerik:RadComboBox ID="rcbGrupo" runat="server" Height="190px" Width="420px"  
     MarkFirstMatch="true" DataSourceID="odsUsuarioGrupo" HighlightTemplatedItems="true"  
     DataTextField="Nombre" DataValueField="Id" NoWrap="True" Sort="Ascending"
     <HeaderTemplate> 
         <ul> 
             <li class="rcbColumn">Id</li> 
             <li class="rcbColumn">Nombre</li> 
         </ul> 
     </HeaderTemplate> 
     <ItemTemplate> 
         <ul> 
             <li class="rcbColumn"><%# DataBinder.Eval(Container.DataItem, "Id") %></li
             <li class="rcbColumn"><%# DataBinder.Eval(Container.DataItem, "Nombre") %></li
         </ul> 
     </ItemTemplate> 
     <CollapseAnimation Duration="100" Type="OutQuint" /> 
</telerik:RadComboBox> 


If is a new register the first item of the radComboBox is selected and for the edit mode the correct item is selected. But when a rule is in the column I'm creating a new DropDown and adding the items but i dont know how to get the correct value on edit mode, i dont have any 'databinder.eval.....' so always when the UC get oppened the first item get selected.

Please it is realle important and i hope you can help me with this

Regards,

Daniel Peralta







3 Answers, 1 is accepted

Sort by
0
Daniel
Top achievements
Rank 1
answered on 21 Sep 2008, 07:02 PM
Hi again me ... please somebody help me with this .. where i can read about it ir see an example ... it is very important ...

Thanks & regards,

Daniel Peralta
0
Accepted
Kiara
Top achievements
Rank 1
answered on 23 Sep 2008, 10:19 AM
Daniel, I read somewhere that the GridDropDownColumns are used when you have DataTable for source because thus the dropdown column Text/Value/DataMember fields can be set.
For other scenarios with different types of source choose dropdown list in edit template of template column. I found this article on this subject.

Kiara
0
Daniel
Top achievements
Rank 1
answered on 23 Sep 2008, 02:04 PM
thx kiara .. that ws whth i need, the diference is hat i have to populate the combo with an XML but it is not problem.....
Tags
Grid
Asked by
Daniel
Top achievements
Rank 1
Answers by
Daniel
Top achievements
Rank 1
Kiara
Top achievements
Rank 1
Share this question
or