Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ASP.NET
<asp:TemplateColumn HeaderText="Amount">
    <itemtemplate>
        <asp:TextBox ID="txtAmount" runat="server" CssClass="txAlign" Width="100px" MaxLength="15" AutoPostBack="true"  OnTextChanged="txtAmount_TextChanged"
             Text='<%# DataBinder.Eval(Container.DataItem,"c5") %>'>
    </itemtemplate>


C#
protected void txtAmount_TextChanged(object sender, EventArgs e)
    {       
        double totalval = 0.00;  
        foreach (DataGridItem item in dgBill.Items)
        {
            if (((TextBox)item.FindControl("txtAmount")).Text!= "")
            {
                totalval = Convert.ToDouble(totalval) + Convert.ToDouble(((TextBox)item.FindControl("txtAmount")).Text);
            }                       
        }
        txtTotAmount.Text = totalval.ToString();        
    }


The above code is working fine in VS2005 am upgrading to .net4.0. I ran the application in VS2010, the above code is not firing and got "RBS_conrol" not defined
Posted
Updated 2-Aug-12 0:04am
v3
Comments
Shemeer NS 2-Aug-12 5:51am    
What's the RBS_conrol ?
harishbablou88 2-Aug-12 5:59am    
I don't know but i got this error on Error Console window in FireFox TypeError: RBS_Controls_Store is undefined
pradiprenushe 2-Aug-12 6:00am    
The postback for a textbox occurs when it loses focus. Are you doing tab out or not?
harishbablou88 2-Aug-12 6:02am    
tab out as well as mouse focus on other controls but event is not firing
pradiprenushe 2-Aug-12 6:08am    
does your problem solved?

1 solution

This code seems to be perfect to me. Problem is not here with this code. Something else you are missing. Try debugging that and trace the error. One more thing, check your CssClass="txAlign".


--Amit
 
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