• Welcome to Valhalla Legends Archive.
 

Textbox Events [asp.net]

Started by Imperceptus, October 06, 2009, 01:42 PM

Previous topic - Next topic

Imperceptus

I have a grid view that I am casting data out of into a textbox.

  Protected Sub gvSpread_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gvSpread.RowDataBound

       Select Case e.Row.RowType
           Case DataControlRowType.DataRow

               Dim txtTicker As TextBox = _
                   TryCast(e.Row.Cells(0).FindControl("TextBox1"), TextBox)

               txtTicker.Attributes.Add("onblur", "validate();")
               txtTicker.Attributes.Add("autocomplete", "off")
               txtTickers.Add(txtTicker.UniqueID)

               AddHandler txtTicker.TextChanged, AddressOf txtTicker_Changed

               Dim txtValue As TextBox = TryCast(e.Row.Cells(1).FindControl("TextBox2"), TextBox)
               txtValue.Text = FormatCurrency(txtValue.Text, 2)
               txtValue.Attributes.Add("onKeyUp", "totalfields();")

               AddHandler txtValue.TextChanged, AddressOf txtTicker_Changed
               ValueTotal += Val(txtValue.Text)


Is expecting the AddHandler statements to actually work a fantasy?  
Quote from: Hazard on August 07, 2003, 03:15 PM
Highlight your entire code. Press the delete key. Start over again using Cuphead's CSB tutorial and work your way from their rather than raping code from downloaded sources meant purely for learning purposes. If this does not fix the problem, uninstall Visual Basic and get a new hobby. I suggest Cricket.

MyndFyre

Quote from: Imperceptus on October 06, 2009, 01:42 PM
Is expecting the AddHandler statements to actually work a fantasy?  

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.textbox.autopostback.aspx

And actually, yes.  Web forms controls don't really maintain state like you're trying for (you'd have to rebind the event every time the page was posted-back).
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Imperceptus

Alrighty, thanks. 

that sucks.

Quote from: Hazard on August 07, 2003, 03:15 PM
Highlight your entire code. Press the delete key. Start over again using Cuphead's CSB tutorial and work your way from their rather than raping code from downloaded sources meant purely for learning purposes. If this does not fix the problem, uninstall Visual Basic and get a new hobby. I suggest Cricket.