Regards,

I have a weird problem with a variable in asp.net + C#.

Those lines work:

DataTable customerDT = service.GetCustomerDT(1);
dataRow["CustomerName"] = customerDT.Rows[0]["FullName"];

But those lines do not found anything even though the value of the variable is "1" too:

int customerID = int.Parse(gridViewRowVar.Cells[0].Text.ToString());
DataTable customerDT = service.GetCustomerDT(customerID);
dataRow["CustomerName"] = customerDT.Rows[0]["FullName"];

The big surprise, as I said before, is that:
I know that the value of the varible is also 1, and to check it I'v tried:

Response.Redirect(customerID.Equals(1).ToString());

It does return True!

But somehow the previous lines don't work.

Thanks to my experience I think it's essential "clean" the varible before using it,
but I don't know how to do this. In asp I think I have used something like: "Clng".

Did u understand me?
Could u help me plz?
Thanks!

pleaseee help me!!!!!!!!!!!!! i cant do anything!!!!!!!please!
even if u didnt understand or dont know just tell me, please~!

yeahhh, i found: i should have typed Cells[1] and not Cells[0]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.