Click here to Skip to main content
15,892,768 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,,
I am getting the following please help how would resolve this...

Conversion failed when converting the varchar value 'DON0000002' to data type int.


else if (e.CommandName.Equals("DonorDataPrint"))
{
GridViewRow clickrowdataprint = ((LinkButton)e.CommandSource).NamingContainer as GridViewRow;
Label lbldonorid = (Label)clickrowdataprint.FindControl("lblDonorNo");
//string url = string.Empty;
//url = "~/FormsPrinting/DonorPrint.aspx";
//url += "donorprint=" + StringHelpers.Encrypt(lbldonorid.Text);
Session["DonorID"] = Convert.ToString(lbldonorid.Text);
Response.Redirect("~/FormsPrinting/DonorPrint.aspx");

}
Posted
Comments
Thanks7872 8-Oct-13 0:57am    
The error is very obvious. DON0000002 cant be converted to int. Whats the problem?
ajays3356 8-Oct-13 1:03am    
So, how would i suppose do this...please suggest me i am new to .net.

and above id that i am taking in an session have to pass in the query which is on another page...
Shubh Agrahari 8-Oct-13 1:09am    
then why you converting this data into int type just as string send it to Query.
ajays3356 8-Oct-13 1:12am    
OOhh,,,Sorry sorry I got it what u are trying to saying ...My mistake...i should simply pass the id.text instead of coverting it to int type...sorry my mistake..
ajays3356 8-Oct-13 1:13am    
And thanks for your help...

1 solution

See these links and try to understand about how to deal with DataTypes,how to pass data between pages.

How to: Pass Values Between ASP.NET Web Pages

.NET Programming - C# DataTypes

DataTypes in C#

Regards..
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900