Click here to Skip to main content
15,922,584 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Can Anyone Explain me how to implement ontext change event in gridview...


and also give example C# coding....
Posted

 
Share this answer
 
v2
hi,
You put the textbox in gridview as
<asp:textbox id....="" ontextchange="ontextchangeEvent" autopostback="true" ...="" xmlns:asp="#unknown">
 and in code behind use the method as

private ontextchangeEvent (object sender, eventargu e)
{
   textbox txt=(textbox)sender;
   gridview grv=(gridview)txt.parentcontainer;
....

}</asp:textbox>
 
Share this answer
 
v2
Comments
RaviRanjanKr 7-Dec-11 17:38pm    
Always wrap your code in "Pre" tag.
 
Share this answer
 
Refer this example
ASP.NET
<asp:textbox id="TextBox1" runat="server" text="<%# Bind("ProductName") %>" autopostback="true" ontextchanged="TextBox1_OnTextChanged"></asp:textbox>

C#
protected void TextBox1_OnTextChanged(object sender, EventArgs e)
{
    TextBox tb1 = ((TextBox)(sender)); GridViewRow gv1 = ((GridViewRow)(tb1.NamingContainer));
    gv1.BackColor = System.Drawing.Color.Red;
    
}
 
Share this answer
 
v2
Comments
M.Narmatha 7-Dec-11 4:44am    
using this event how to calculate totalprice of all rows ... it display out of gridview....

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