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

GridDropDownColumn will not get "selectedvalue"

2 Answers 72 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Charles
Top achievements
Rank 1
Charles asked on 15 Jun 2012, 07:40 PM
Just bought the telerik controls, have radgrid working on other pages fine, but this one is not selecting the right value from the database. it shows the dropdownlist but it's always the first one.

Select Command returns: 1 or 0 bit value in sql
ColumnName in sql is :EventTitleStatus

The odsGetTitleStatuses: returns a datatable:
Yes: 1
No: 0


   <telerik:GridDropDownColumn DataSourceID="odsGetTitleStatuses"  DataType="System.Int32" HeaderText="Visible"
                    FilterControlAltText="Filter column1 column" ListTextField="StatusText" SortExpression="EventTitleStatus"
                    ListValueField="StatusValue" UniqueName="EventTitleStatus" DataField="EventTitleStatus">
                </telerik:GridDropDownColumn>

What am I doing wrong??

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 18 Jun 2012, 06:28 AM
Hi,

Try setting the DataField property of the GridDropDownColumn to get the right value from the data base.

ASPX:
<telerik:GridDropDownColumn DataSourceID="odsGetTitleStatuses"  DataType="System.Int32" HeaderText="Visible" FilterControlAltText="Filter column1 column" ListTextField="StatusText" SortExpression="EventTitleStatus" ListValueField="StatusValue" UniqueName="EventTitleStatus" DataField="StatusText" DataField="StatusText"></telerik:GridDropDownColumn>

Thanks,
Shinu.
0
Charles
Top achievements
Rank 1
answered on 18 Jun 2012, 12:57 PM
Edited---

I got It working!! I didn't see it until I displayed the field. The database field is a bit (1,0) but when displayed in RadGrid it is (True,False) so instead of the drop down being:

Yes:1
No:0

I changed it to

Yes:True
No:False

And it's working now!!

Thanks for you help
Tags
Grid
Asked by
Charles
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Charles
Top achievements
Rank 1
Share this question
or