hello i have one formview control n i want to retrive values from that n add save them in local variables pcode:
pname:
price: Rs. Return to the main shop this is .cs file code for iamgebutton's click event: protected void ImageButton2_Click(object sender, System.Web.UI.ImageClickEventArgs e) { string pname = ((Label)FormView1.FindControl("pnameLabel")).Text; string price = ((Label)FormView1.FindControl("priceLabel")).Text; double price = double.Parse(p.ToString()); } i get error while retriving values of labels : Error1'Label' is an ambiguous reference between 'System.Web.UI.WebControls.Label' and 'System.Windows.Forms.Label' n for double.Parse: like : "Input string was not in a correct format"
Loading

Neha SharmaPosted Aug 15, 2012, 5:49 AM
Please check you are using same label with one ID twice,and give different ID values your problem ll solve and you ll rock.
If this post solve your problem chek this is correct answer for other people to be helped from this post.
Thx.
Rahul BhattPosted Jul 27, 2012, 1:16 AM
There is duplcate label name in your page
Find FormView Refrence Label as following way
Using System.Web.UI.WebControls.Label find Label refrence
LOGIC
protected void ImageButton2_Click(object sender, System.Web.UI.ImageClickEventArgs e)
{
FormView FormView1 = new FormView();
string pname = ((System.Web.UI.WebControls.Label)FormView1.FindControl("pnameLabel")).Text;
string p = ((System.Web.UI.WebControls.Label)FormView1.FindControl("priceLabel")).Text;
double price = double.Parse(p.ToString());
}
Master BillaPosted Sep 26, 2009, 12:11 AM
1.Error 1 'Label' is an ambiguous reference between 'System.Web.UI.WebControls.Label' and 'System.Windows.Forms.Label
This is happening by you have added System.Window.Forms reference also in your web project, so remove that
2.p is null or empty Or it may be char other than no values.before cast please check in debug what is value is P have.
thank you