To illustrate my last thread, the following does not work:
double iS = 5;
double iT = 10;
double iR = iS/iT;
((LinkButton)e.Item.FindControl(lblResult)).Text = iR.ToString();
I get the error listed below.
:
Thanks for the help. As for the ".text" vs. ".Text", the VS.NET would not
allow this to compile, so this is not the problem, although, i my sample code
below, this was indeed correct.
The *real* code is:
double iS = (Convert.ToDouble(((DataRowView)e.Item.DataItem).Row["ObsSafe"]));
double iT =
(Convert.ToDouble(((DataRowView)e.Item.DataItem).Row["ObsScores"]));
double iR = iS/iT;
((LinkButton)e.Item.FindControl(lblResult)).Text =
System.Convert.ToString(iR);
The above works fine for all other operations. In fact, i've tried this with
manual values, following the sample below, and i still get errors.... The
error generated is:
A first chance exception of type 'System.InvalidCastException' occurred in
marsh.dll
Additional information: Specified cast is not valid.
Any thoughts?
:

I didn't even notice that
G.
re:
This should normally work.
That *does* work...if you change .text to .Text
Not :
txtResult.text = System.Convert.ToString(r);
but :
txtResult.Text = System.Convert.ToString(r);
DoubleToString.aspx :
--------------------------------
<%@ page language="C#" %>
<script language = "C#" runat="server">
void Page_Load(){
double i = 5;
double s = 10;
double r = i/s;
txtResult.Text = System.Convert.ToString(r);
}
</script>
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Double To String</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="txtResult" Runat="server" Text=""></asp:Label>
</div>
</form>
</body>
</html>
---------
Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
======================
double i = 5;
double s = 10;
double r = i/s;
txtResult.text = System.Convert.ToString(r);
This should normally work. What is the type of txtResult? Instance of
TextBox class or a control you created yourself?
Gabriel Lozano-Morán