Ok, I have taken your advice, but something still isn't quite right.
The function is returning p_requirment and I need it to show in this
literal <asp:literal id="p_requirment" EnableViewState="true"
runat="server" />

Here is the code:

------------------------------------------------------------------------------
<%@ Import Namespace="System.Data.sqlclient" %>
<%@ Import Namespace="System.Math" %>
<%@ Import Namespace="System.Configuration.ConfigurationSettings" %>
<script language="VB" runat="server">
Sub Page_Load(Src As Object, E As EventArgs)
    Dim Conn as SQLConnection
    Dim Rdr as SQLDatareader
        
        Dim amps as integer = 12
        
        Dim cells_series as integer = 3
        
        Dim throttle as integer = 100
        
        Dim pack_voltage as double
        pack_voltage = 3.7 * cells_series
        
        Dim fresh_charge as integer
        fresh_charge = 4.2 * cells_series
        
        Dim cut_off_voltage as integer
        cut_off_voltage = 3 * cells_series
                        
    TRY
        Dim strConn as string =AppSettings("fmaConnect")
        Dim strSQL as string ="select fma_pn, nom_cell_cap,
battery_c_rating, full_discharge_derating, cell_weight FROM LIPOCALC"
        Conn=New SQLConnection(strConn)
        Dim Cmd as New SQLCommand(strSQL,Conn)    
        Conn.Open()
        Rdr=Cmd.ExecuteReader()
        myDataGrid.DataSource = Rdr
        myDataGrid.DataBind()
    CATCH exc1 as exception
        litExc.text=exc1.tostring()
    FINALLY
        IF Not(rdr Is Nothing)
            IF rdr.IsClosed=false THEN Rdr.Close() 
            End If
        If not(conn is Nothing)
            IF Conn.State=System.Data.Connectionstate.Open THEN Conn.Close()
        End If
    END TRY
End Sub

Public Function FunctionToCall(ByVal x as double, ByVal y as double) as double
 Dim amps as integer
 amps = 12
 
 Dim p_requirment as double
 p_requirment = amps + 1
 return p_requirment
End Function

</script>
<html><head>
<title>SQLClient Data</title>
</head>
<body bgcolor="#FFFFFF">
<font face="Verdana"><h3>SQLClient Data</h3></font>

<asp:literal id="litexc" EnableViewState="false" runat="server" />

 <asp:Repeater id="myDataGrid" runat="server">
        <HeaderTemplate>
            <table border="1">
                         <tr>
                <td align="center" class="verticaltext">
                        <strong>FMA Base PN</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Nominal Cell Capacity (mAh)</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Battery "C" Rating</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Full C Discharge Derating</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Parallel Requirment</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Configuration</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Total mAh</strong>
                </td>           
                <td align="center" class="verticaltext">
                        <strong>Full C mAh (Derated)</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Time @ Full Capacity (Minutes)</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Time @ De-rated Capacity (Minutes)</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Cell Weight</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Total Weight (gm-Cells Only)</strong>
                </td>
                <td align="center" class="verticaltext">
                        <strong>Total Cells</strong>
                </td>
        </tr>
        </HeaderTemplate>
       
                <AlternatingItemTemplate>
            <asp:Label Runat=server
Text='<%FunctionToCall(DataBinder.Eval(Container.DataItem,
"nom_cell_cap"),DataBinder.Eval(Container.DataItem,
"battery_c_rating"))%>'> </asp:Label>

                   <tr>
                        <td align="center" class="bodytext">
                                <%# DataBinder.Eval(Container.DataItem, "fma_pn") %>
                        </td>
                        <td align="center" class="bodytext">
                                <%# DataBinder.Eval(Container.DataItem, 
"nom_cell_cap") %>
                        </td>
                        <td align="center" class="bodytext">
                                <%# DataBinder.Eval(Container.DataItem, 
"battery_c_rating") %>
                        </td>
                        <td align="center" class="bodytext">
                                <asp:literal id="p_requirment" EnableViewState="true" 
runat="server" />
                        </td>
                        <td align="center" class="bodytext">
                                
                        </td>
                        <td align="center" class="bodytext">
                                
                        </td>
                        <td align="center" class="bodytext">
                                
                        </td>   
                        <td align="center" class="bodytext">
                                
                        </td>   
                        <td align="center" class="bodytext">
                                
                        </td>   
                        <td align="center" class="bodytext">
                                
                        </td>   
                        <td align="center" class="bodytext">
                                
                        </td>   
                        <td align="center" class="bodytext">
                                
                        </td>
                        <td align="center" class="bodytext">
                                
                        </td>                                                          
 
                </tr>
        </AlternatingItemTemplate>
        
        <FooterTemplate>
            </table>
        </FooterTemplate>
    </asp:Repeater>


</body></html>










---------------------------------------------------------------------------------


On Thu, 30 Sep 2004 09:20:54 -0400, Mike Appenzellar
<[EMAIL PROTECTED]> wrote:
> I think this may help, however I don't need to output that variable, I
> need to calculate that variable before I can output the variable that
> will be displayed on a page. My problem really is this....in cold
> fusion I could do this:
> 
> <cfquery name="getNums" datasource="#dsn#">
> SELECT num1, num2 FROM NUMBERS
> </cfquery>
> 
> <cfset tempNum = 2>
> 
> <cfoutput query="getNums">
>   <cfset tempNum = tempNum * num1>
>   <cfset tempNum2 = tempNum / num2>
> 
>   Display TempNum2: #tempNum2#
> 
> </cfoutput>
> 
> Basically I am trying to do the same type of think with asp.net
> 
> 
> 
> 
> ----- Original Message -----
> From: zazo_zazo70 <[EMAIL PROTECTED]>
> Date: Thu, 30 Sep 2004 08:23:00 -0000
> Subject: [AspNetAnyQuestionIsOk] Re:setting variables within an
> AlternatingItemTemplate...possible?
> To: [EMAIL PROTECTED]
> 
> Hi,
> 
> As i can understand that you are trying to display a text, so Change
> this line of code
> 
> <AlternatingItemTemplate>
>            <%
>                        Dim p_requirment as double
>                        p_requirment.text = ceiling(amps /
> ((DataBinder.Eval(Container.DataItem, "nom_cell_cap") *
> DataBinder.Eval(Container.DataItem, "battery_c_rating"))/1000))
>                  %>
> to the following
> <tr>
> <td>
> <asp:Label Runat=server Text='<%FunctionToCall(DataBinder.Eval
> (Container.DataItem, "nom_cell_cap"),DataBinder.Eval
> (Container.DataItem, "battery_c_rating"))%>'>
> </asp:Label>
> </td>
> </tr>
> 
> and in the codeBehind wirte a public function with the exactName
> which accepts two paramter and return a string
> HTH
> Best Regards
> Mohamed Zahra
> 
> Yahoo! Groups Sponsor
> 
> ADVERTISEMENT
> 
> ________________________________
> Yahoo! Groups Links
> 
> To visit your group on the web, go to:
> http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
> 
> To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]
> 
> Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
>


------------------------ Yahoo! Groups Sponsor --------------------~--> 
$9.95 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/J8kdrA/y20IAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~-> 

 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to