Hello, it turns out that I have the following error, and I don't know how to do the conversion correctly.
I think it must come from this line.
protected void DDL_FamiliaProducto_SelectedIndexChanged(object sender, EventArgs e)
{
HddFamilia.Value = DDL_FamiliaProducto.SelectedValue;
DDL_SubFamiliaProducto.Items.Clear();
DDL_SubFamiliaProducto.Items.Insert(0, new ListItem("---SELECCIONE---"));
//esta es la linea
HDDSubFamilia.Value = DDL_SubFamiliaProducto.SelectedValue;
DDL_MarcaProducto.Items.Clear();
DDL_MarcaProducto.Items.Insert(0,new ListItem("--SELECCIONE--"));
}
Why will it be? Well clearly it is taking me as nvarchar but how do I do the conversion correctly.
This also comes from a stored procedure where I have 2 variables declared as NVARCHAR() which are compared with some fields of some tables that are in INT , but if I change the value of those variables to INT it throws me this error:
That's why I think that it must be that line (that I indicated with a comment) that.
I await your responses, thank you.
The signature of the Insert method you are using is:
So the 0 you are adding is not the value but the index. Then later when you use that item to send it to the base it fails because it doesn't have a value that can be converted to
int
. So you could do the following:And set 0 as value.