473,322 Members | 1,734 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

handling user control event

Hi all,
I have an event in user control email to handling email change when user
want to change the input for email address. Here it is
In email.ascx.vb:
Protected Sub UpdateEmail(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TxtEmail.TextChanged
If Session("Email") <> Me.Email Then
Session("Email") = TxtEmail.Text 'or me.email
End If
End Sub
In email.ascx, I have
<asp:TextBox id="TxtEmail" OnTextChanged="UpdateEmail" runat="server"
</asp:TextBox>

My purpose is to update session variable if there is anything has been
changed for the email address.
But his event doesn't fire after I made the change in the text box until I
click the continue button on the page. The update session variable doesn't
work. I don't know why.

And I have to add the some code in the page containing the email user
control to make the update working. But it doesn't make any sense to me to
have event handler. here it is:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Session("Email") <> "" Then
If Email.Email <> Session("Email") Then
Session("Email") = Email.Email
Else
Email.Email = Session("Email")
End If

End If

End Sub
--
I might chase my tail. Can someone shed light on me?
Betty
Feb 4 '06 #1
3 1539
1.) In order for you to do a postback when you exit the textbox, you need to
set the Autopostback property to True for that TextBox..

2.) <<<*** If you have already tested that Email.Email <> Session.("Email")
is False ( meaning they are the same ) then
why do you need to make the assignment. Or have I missed something ?
And I have to add the some code in the page containing the email user
control to make the update working. But it doesn't make any sense to me to
have event handler. here it is:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Session("Email") <> "" Then
If Email.Email <> Session("Email") Then
Session("Email") = Email.Email
Else
Email.Email = Session("Email") <<< ****
End If

End If
--
Terry Burns
http://TrainingOn.net
"c676228" <be****@community.nospam> wrote in message
news:C5**********************************@microsof t.com... Hi all,
I have an event in user control email to handling email change when user
want to change the input for email address. Here it is
In email.ascx.vb:
Protected Sub UpdateEmail(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TxtEmail.TextChanged
If Session("Email") <> Me.Email Then
Session("Email") = TxtEmail.Text 'or me.email
End If
End Sub
In email.ascx, I have
<asp:TextBox id="TxtEmail" OnTextChanged="UpdateEmail" runat="server"
</asp:TextBox>

My purpose is to update session variable if there is anything has been
changed for the email address.
But his event doesn't fire after I made the change in the text box until I
click the continue button on the page. The update session variable doesn't
work. I don't know why.

And I have to add the some code in the page containing the email user
control to make the update working. But it doesn't make any sense to me to
have event handler. here it is:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Session("Email") <> "" Then
If Email.Email <> Session("Email") Then
Session("Email") = Email.Email
Else
Email.Email = Session("Email")
End If

End If

End Sub
--
I might chase my tail. Can someone shed light on me?
Betty

Feb 4 '06 #2
Terry,
thank you. I forgot that autopastback issue.
for Email.Email = Session("Email") <<< ****
is to make sure that when users navigate the pages, I want to make sure that
the value in the control wouldn't disappear, that's why, each time the page
is reloading and if the session variable is there already and not changed,
reload that value to control again. I think I probably didn't design the
program in a right way.
Do you have better idea besides Steven mentioned that I can use .net 2.0 to
solve this problem?

--
Betty
"Terry Burns" wrote:
1.) In order for you to do a postback when you exit the textbox, you need to
set the Autopostback property to True for that TextBox..

2.) <<<*** If you have already tested that Email.Email <> Session.("Email")
is False ( meaning they are the same ) then
why do you need to make the assignment. Or have I missed something ?
And I have to add the some code in the page containing the email user
control to make the update working. But it doesn't make any sense to me to
have event handler. here it is:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Session("Email") <> "" Then
If Email.Email <> Session("Email") Then
Session("Email") = Email.Email
Else
Email.Email = Session("Email") <<< ****
End If

End If


--
Terry Burns
http://TrainingOn.net
"c676228" <be****@community.nospam> wrote in message
news:C5**********************************@microsof t.com...
Hi all,
I have an event in user control email to handling email change when user
want to change the input for email address. Here it is
In email.ascx.vb:
Protected Sub UpdateEmail(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TxtEmail.TextChanged
If Session("Email") <> Me.Email Then
Session("Email") = TxtEmail.Text 'or me.email
End If
End Sub
In email.ascx, I have
<asp:TextBox id="TxtEmail" OnTextChanged="UpdateEmail" runat="server"
</asp:TextBox>

My purpose is to update session variable if there is anything has been
changed for the email address.
But his event doesn't fire after I made the change in the text box until I
click the continue button on the page. The update session variable doesn't
work. I don't know why.

And I have to add the some code in the page containing the email user
control to make the update working. But it doesn't make any sense to me to
have event handler. here it is:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

If Session("Email") <> "" Then
If Email.Email <> Session("Email") Then
Session("Email") = Email.Email
Else
Email.Email = Session("Email")
End If

End If

End Sub
--
I might chase my tail. Can someone shed light on me?
Betty


Feb 7 '06 #3
Hi Betty,

After you apply the "AutoPostBack" =true to the Textbox, each time
TextBox's Text is change at client, the page will be posted back, and you
can update the session in the TextBox's TextChanged event handler. There is
not need to add the update code in Page_Load again. If you want to keep
the TextBox's Text synchronous with the Session's value, just add the code
in (Not IsPostBack) because during post back, the TextBox's Text should be
the latest value (unless the same user open this page again and update this
value :))

====================
Private Sub Page_Load

If Not Page.IsPostBack Then

Email.Email = Session("xxx")
End If

End Sub
===================

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 7 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: John Fereira | last post by:
So, one of the limitations of multipart-form handling is that when an <input type="file" ..> tag is used it will bring up a window which allows a user to select a file for upload but won't allow...
8
by: Tim Geiges | last post by:
Since I am being challenged with learning c# I figured I could pass some of the pain on to you guys :-) I have another question(this one is important for me to fix before I can get my app to Beta)...
12
by: scsharma | last post by:
Hi, I am working on creating a webapplication and my design calls for creating main webform which will have menu bar on left hand side and a IFrame which will contain all the forms that are shown...
9
by: Sridhar | last post by:
Hi, I have created a web page which includes a place holder. I also have a dropdown list in that webpage. when I select one of the choices in that dropdown list, It will load a user control...
11
by: chopsnsauce | last post by:
Here's the example: Dim frm As New FORM1 Try frm.show Catch ex As Exception msgbox ex.message
2
by: Developer_Software | last post by:
Thanks in advance to anyone who can help :) I've got a placeholder control WITHIN A USER CONTROL that has its contents dynamically added and removed at runtime by a regular .aspx page. At...
1
by: EricRybarczyk | last post by:
I am starting a rewrite of an existing Classic ASP web site in ASP.NET 2.0. The existing ASP application has several types of users, each with a separate login process (separate login page,...
2
by: weboweb | last post by:
Hail the experts!!! I'm creating a web user control which displays a hierarchical tree of items from an xml string passed to the control (from the host page) through an exposed property. This...
1
by: Efi Merdler | last post by:
Hi, I created a user control, but instead of handling exception in the user control level I prefer to handle them in the containing form. In the load event of the containing form I'm using:...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.