Object of type 'System.Web.UI.WebControls.TextBox' cannot be converted to type 'System.Int32'
6 minutes ago|LINK
Hi, i started web application in Microsoft Visual Web Developer 2010 Express. I created few text boxes and dropdown lists. I connect them with my database in SQL management studio. When I click on SaveButton it should be saved in the base table, but it shouldn't. I write this code on the save button click and when I run project it says:
Failed to set one or more properties on type x.y. Object of type 'System.Web.UI.WebControls.TextBox' cannot be converted to type 'System.Int32'.
How can I solve this. This is my first app, so if anyone could help with my trouble.... :D thanks
protected void Button_Click(object sender, EventArgs e)
{
{
ListDictionary lstNewValues = new ListDictionary();
lstNewValues.Add("OfferID", txtOfferID);
lstNewValues.Add("OfferName", txtOfferName);
lstNewValues.Add("OfferPeriod", ddOfferPeriod);
lstNewValues.Add("OfferPrice", txtOfferPrice);
lstNewValues.Add("OfferDetails", ddAgencyName);
LinqDataSource1.Insert(lstNewValues);
Response.Redirect("PonudiNaAgencii.aspx");
}
}
Also I used LinqDataSource to connect dropdownlists.