Hi Folks,
first of all, I'm new to Telerik controls. I'm using a RadGrid to display some data, which contains a DropDown column. The grid is bound to a data table on the page load event. Source of this is a SQL server. Here some Code of my binding:
Protected
Sub
Page_Load(
ByVal
sender
As
Object
,
ByVal
e
As
EventArgs)
Handles
Me
.Load
Dim
table_competitor_work
As
DataTable = getSQLData(
"SELECT competitor, value, units FROM competitor_work"
)
RadGrid1.DataSource = table_competitor_work
RadGrid1.DataBind()
End
Sub
Protected
Function
getSQLData(
ByVal
query
As
String
)
As
DataTable
Dim
connString
As
String
=
"Data Source=home-sps2010\POWERPIVOT;Initial Catalog=marketsurvey;Integrated Security=SSPI;"
Dim
conn
As
New
SqlConnection(connString)
Dim
cmd
As
SqlCommand =
New
SqlCommand(query, conn)
conn.Open()
Dim
dr
As
SqlDataReader = cmd.ExecuteReader(CommandBehavior.CloseConnection)
Dim
dt
As
New
DataTable
dt.Load(dr)
conn.Close()
Return
dt
End
Function
And here is my markup code:
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
AutoGenerateColumns
=
"False"
AutoGenerateDeleteColumn
=
"True"
AutoGenerateEditColumn
=
"True"
CellSpacing
=
"0"
GridLines
=
"Horizontal"
Skin
=
"Telerik"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
>
<
MasterTableView
CommandItemDisplay
=
"Top"
CommandItemSettings-AddNewRecordText
=
"Add new customer"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
/>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
>
<
HeaderStyle
Width
=
"20px"
/>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
>
<
HeaderStyle
Width
=
"20px"
/>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridDropDownColumn
EmptyListItemText
=
"Empty"
EmptyListItemValue
=
"Empty"
FilterControlAltText
=
"Filter Customer column"
HeaderText
=
"Competitor"
UniqueName
=
"Competitor"
DataField
=
"competitor"
>
</
telerik:GridDropDownColumn
>
<
telerik:GridNumericColumn
DecimalDigits
=
"2"
FilterControlAltText
=
"Filter Value column"
HeaderText
=
"Value 2010"
UniqueName
=
"Value"
DataField
=
"value"
>
</
telerik:GridNumericColumn
>
<
telerik:GridNumericColumn
DecimalDigits
=
"0"
FilterControlAltText
=
"Filter Units column"
HeaderText
=
"Units 2010"
UniqueName
=
"Units"
DataField
=
"units"
>
</
telerik:GridNumericColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
>
</
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
<
FilterMenu
EnableImageSprites
=
"False"
>
</
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Default"
>
</
HeaderContextMenu
>
</
telerik:RadGrid
>
The strange thing is, the binding an everything works not on the dropdown column. Nothing is displayed and I don't now why. I wanted to bind the dropdown column to a sql datasource and in the insert and edit forms I wanted to diplay other data for the dropdown list. I thought I can do it that way:
DataField="SQLserverField" (bound in code behind at runtime)
DataSourceID="SQLDataSource" (same database, but other table)
ListTextField="SQLDataSourceField"
ListValueField="SQLDataSourceField"
But that isn't working so well. Still there are no value displayed in the grid. But On insert and edit the right values are there.
Do you have an idea?
Thanks and regards,
Mark