asp.net - Textchange event firing without any change in textbox contents -
i have form record number, boxes "primary" notes , effective date.
then have optional "secondary" notes , effective date box.
when clicks on button edit primary or secondary notes, looks see if other notes have changed (a session variable set "true" fires "textchanged" event other textbox). if so, instead of enabling textbox matched "edit" button, flashes message saying cancel or update other textbox's changes.
my problem contents of textbox being viewed "changed" when nothing changed. if load record, , run separate validation check, verifies contents of textbox match data loaded textbox. then, not changing anything, when click on "edit" button, separate validation comes no longer matching, though information in session variable , textbox both unchanged.
here validation check -
if not session("sn1") nothing sesslst = sesslst & "<p>sec notes match = " & (trim(session.item("sn1").tostring) = trim(txtsecondarynotes.text)).tostring sesslst = sesslst & "<p>sec date match = " & (trim(session.item("sd1").tostring) = trim(txtseceffdate.text)).tostring sesslst = sesslst & "<p>s = " & trim(session.item("sn1").tostring) sesslst = sesslst & "<p>f = " & trim(txtsecondarynotes.text) end if lbltest.text = sesslst
here results after initial record load:
sn1 - bill smith (father) 10/12/1971 linda smith (mother) 7/22/1971 boudreau w smith (brother) 6/7/1994
sd1 - 4/1/2014 12:00:00 am
sec notes match = true
sec date match = true
s = bill smith (father) 10/12/1971 linda smith (mother) 7/22/1971 boudreau w smith (brother) 6/7/1994
f = bill smith (father) 10/12/1971 linda smith (mother) 7/22/1971 boudreau w smith (brother) 6/7/1994
(all specific data in example has been changed, no real personal information being displayed)
when click edit button , validation loop runs again, "sec notes changed" value changes "false," nothing else changes.
initially, had session variable record change set "textchanged" event. when kept setting, despite no change, added additional validation within change event. if both notes , dates session variable not match field information, sets session variable changed -
protected sub txtsecondarynotes_textchanged(sender object, e eventargs) handles txtsecondarynotes.textchanged, txtseceffdate.textchanged if not ((trim(session.item("sn1").tostring) = trim(txtsecondarynotes.text)) , (trim(session.item("sd1").tostring) = trim(txtseceffdate.text))) session.item("secondaryediting") = true end if end sub
i never passed check "secondaryediting" session variable when click edit button (the lstsess() proc lists session variable names , values can see what's being compared) -
protected sub btneditprimary_click(sender object, e eventargs) handles btneditprimary.click txtpolicy.text = trim(txtpolicy.text).toupper lstsess() if session.item("secondaryediting") = true secmsg.visible = true exit sub else secmsg.visible = false end if
so, thought problem, initially, maybe form, loading of data, , textchanged event firing not being evaluated until button pushed, when add in additional if-->then validation within event, still thinks has changed, when data in field has not been enabled, let alone manipulated.
how can evaluate whether text in field has changed? fyi - asp:textbox objects have been set , without "autopostback = 'true'" no difference in how runs.
save efforts, folks. original programmer did not import of necessary system , system.web classes.
Comments
Post a Comment