Hi,
I have a radcombobox in a form page:
VB code:
i want to populate the control with external module
this is the code in the module:
When i press the button the debug is good, if i control in debug mode the combox response correctly populate:
?cbxProva.Items(1).Text
"ACQUARICA DEL CAPO"
But the combobox in the page is empty...
Why?
I have a radcombobox in a form page:
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
div
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
asp:Button
ID
=
"Button1"
runat
=
"server"
Text
=
"Button"
/>
<
telerik:RadComboBox
ID
=
"cbxProva"
runat
=
"server"
>
</
telerik:RadComboBox
>
</
div
>
</
form
>
</
body
>
</
html
>
VB code:
Protected
Sub
Button1_Click(
ByVal
sender
As
Object
,
ByVal
e
As
System.EventArgs)
Handles
Button1.Click
cbxProva = CaricaComuni(
"LE"
)
End
Sub
i want to populate the control with external module
this is the code in the module:
Public
Function
CaricaComuni(
ByVal
Provincia
As
String
)
As
RadComboBox
CaricaComuni =
New
RadComboBox
Try
Dim
sql
As
String
sql =
"SELECT IdComune, Comune FROM Sys_Comuni WHERE Provincia = @Provincia AND RecordEliminato = 0 ORDER BY Comune"
Dim
adapter
As
New
SqlDataAdapter(sql, connStr)
adapter.SelectCommand.Parameters.Add(
"@Provincia"
, SqlDbType.
Char
).Value = Provincia
Dim
dt
As
New
DataTable()
adapter.Fill(dt)
CaricaComuni.DataSource = dt
CaricaComuni.DataTextField =
"Comune"
CaricaComuni.DataValueField =
"IdComune"
CaricaComuni.DataBind()
CaricaComuni.Items.Insert(0,
New
RadComboBoxItem(
""
,
""
))
Catch
ex
As
Exception
'MessageBox(ex.Message, ex.StackTrace.Substring(ex.StackTrace.LastIndexOf("\") + 1))
End
Try
End
Function
When i press the button the debug is good, if i control in debug mode the combox response correctly populate:
?cbxProva.Items(1).Text
"ACQUARICA DEL CAPO"
But the combobox in the page is empty...
Why?