TextBox event handling inside a datalist on a WebForm
-
This is a WebForm application I have created an app that binds (onItemDataBound) 3 textboxes in a datalist, Quantity, Rate and Total. The user enters the quantity and the rate, upon leaving the rate field the program needs to compute the total. Is there an event available in WebForms that will recognize that the cursor has left the Rate textbox, so I can compute the total and display it in the Total Textbox on that row. I know how to get the data in and out during pre & post processing I just don't know what event is called when leaving the textbox. Thanks, Chuck..
-
This is a WebForm application I have created an app that binds (onItemDataBound) 3 textboxes in a datalist, Quantity, Rate and Total. The user enters the quantity and the rate, upon leaving the rate field the program needs to compute the total. Is there an event available in WebForms that will recognize that the cursor has left the Rate textbox, so I can compute the total and display it in the Total Textbox on that row. I know how to get the data in and out during pre & post processing I just don't know what event is called when leaving the textbox. Thanks, Chuck..
well there are 2 things you do set for your Rate Textbox the next statements - AutoPostBack="true" - OnTextChanged="txtRate_OnTextChanged" Create in the code behind the next eventhandler: protected void txtRate_OnTextChanged(Object sender, EventArgs e) { // place your code here }
In Word you can only store 2 bytes. That is why I use Writer.
-
well there are 2 things you do set for your Rate Textbox the next statements - AutoPostBack="true" - OnTextChanged="txtRate_OnTextChanged" Create in the code behind the next eventhandler: protected void txtRate_OnTextChanged(Object sender, EventArgs e) { // place your code here }
In Word you can only store 2 bytes. That is why I use Writer.
Digimanus, Thanks for your response. Everything seems to code fine until it comes to the code behind, which is VB.NET. Because this is a TextBox embedded in a datalist, I need to index of the entry that envoked the OnTextChange event which as far as I know, and that might not be very far, can only be aquired through the parameter: "byval e as System.Web.UI.WebControls.DatalistItemEventArgs" which does not match the "byval e as System.EventArgs" requirements of the OnTextChanged subroutine. This appears to be the exact way to make this happen except for having the datalist entry returned to the called subroutine. Do you know of a way that I can aquire the index of the current entry in the datalist using the System.EventArgs object? Thanks