Hi,
I have problems retrieving the text of a raddropdownlist.
I populate the ddl in a quite basic way (Articles is a datatable):
ddlArticle.DataSource = Articles;
ddlArticle.DataTextField = "Description";
ddlArticle.DataValueField = "CodArt";
ddlArticle.DataBind();
Changing the selected value triggers nothing.
A button near the ddl triggers some events (basically, a databind on a radgrid); at this time i need to read datatextfield and datavaluefield:
string opv = ddlArticle.SelectedValue;
string articlename = ddlArticle.SelectedItem.Text;
ddlArticle.SelectedValue works perfectly and opv really contains the selected value, but ddlArticle.SelectedItem.Text throws an exception:
Exception thrown: 'System.NullReferenceException' in App_Web_prodotto.aspx.11948b1e.cmqcknjt.dll ("Object reference not set to an instance of an object.")
So i tried another way:
string opv = ddlArticle.SelectedValue;
RadComboBoxItem Item = ddlArticle.FindItemByValue(opv);
string article = Item.Text;
Again, opv contains the correct value, but Item.text is null, and Item is null too.
I am using Telerik 2016.3.
Thank you for any help you can provide.