Gridview Textbox Textchanged event

Posted by Yjeevanrao under Regular Expressions on 9/7/2010 | Points: 10 | Views : 48362 | Status : [Member] | Replies : 3
Hi,

Where in my application i am binding products table to gridview then when i enter the quantity in the quantity column it should calculate with the price and display the total in the total column. How can i do this in gridview.

Regards,
Jeevan.

Jeevan


Responses

Posted by: Shankul2784 on: 9/7/2010 [Member] Bronze | Points: 25

Up
0
Down
Hi,

you can achieve this using the javascript. In databound event you can write the javascript & add that in the footer.

other way is that you can use the text_changed event & you can achieve it.

Thanks & Regards,

Shailesh

Yjeevanrao, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: T.saravanan on: 9/7/2010 [Member] [MVP] Silver | Points: 25
Posted by: Sonalee2304 on: 9/8/2010 [Member] Starter | Points: 25

Up
0
Down
This will be your template field in .aspx:
<asp:TemplateField >
<ItemTemplate >
<asp:TextBox ID ="tunit" runat ="server" onTextChanged="TextChangedEvent"/>
</ItemTemplate>
</asp:TemplateField>

This will be your code in .aspx.cs:
TextChangedEvent(object sender,EventArgs e)
{
//Get the current row in grid
GridViewRow currentRow = (sender as TextBox).Parent.Parent;

//Do the necessary calculation and display the total
}

Yjeevanrao, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response