473,320 Members | 1,978 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,320 software developers and data experts.

javascript user control event for page.

Hey guys, bad title i know:)

Well my problem is as follows:

I have a javascript user control, a grid, wich is on an .aspx page.
On the grid I can scroll between records, up and down, and click them.
Now I want to create an event in the grid that lets the page know if a different record is chosen, a record is changed and so on.

I tried using event/delegates to solve this and I do get the information from the javascript to the page but when I try to change a label on the page, the label stays the same, with the original text value.

The Page_Load for .aspx page.
Expand|Select|Wrap|Line Numbers
  1. protected void Page_Load(object sender, EventArgs e)
  2.         {
  3.  
  4.             NAVPointScriptServiceHandler.Basics.sendMessageToThePage += new NAVPointScriptServiceHandler.SendMessageToThePageHandler(Basics_sendMessageToThePage);
  5.        }
  6.  
  7. void Basics_sendMessageToThePage(string messageToThePage)
  8.         {
  9.               lblUserControlTextBoxValue.Text = messageToThePage;
  10.         }
  11.  
Here I do get the messageToThePage value, and when debugging i can see the value i sent from the javascript but the label does not change.
Can anyone help me explain why or point me to a better way of doing this, preferably without using UpdatePanel? :)

Thanks.
Aug 7 '08 #1
9 1562
acoder
16,027 Expert Mod 8TB
Show the HTML code for the label.

PS. please enclose your code in code tags. See How to Ask a Question. Thanks.
Aug 7 '08 #2
Show the HTML code for the label.

PS. please enclose your code in code tags. See How to Ask a Question. Thanks.
This is how im using my label on the page.

Expand|Select|Wrap|Line Numbers
  1. Value of user control TextBox is: <asp:Label ID="lblUserControlTextBoxValue" runat="Server"  Font-Bold="True" />
But, better, i have a picture explaining what i want the user controls to be able to do.



I want other instances of that user control to be able to listen to any of the user controls and maybe the page, but thats optional right now.

The user controls use ajax enabled callbacks.

Thanks for the reply.
Aug 7 '08 #3
acoder
16,027 Expert Mod 8TB
Show the client-side generated code, not ASP.NET, i.e. how it appears in your browser if you view the source.
Aug 7 '08 #4
Show the client-side generated code, not ASP.NET, i.e. how it appears in your browser if you view the source.
Ah ok, well since it wasnt working i removed from the javascript in my user control:)

But here´s how it did work.

1. When user pressed U in the user control called Table1.
2. Table1 sends out an event.
3. And every other user control(ex. Table2 and Table3) that is listening to that event should receive info from Table1.

So basically i´m asking you guys for some ideas as how to do this.
Anything would be helpful.

Thanks for the response:)

Regards, Viktor Einarsson.
Aug 7 '08 #5
acoder
16,027 Expert Mod 8TB
Call a function on the event in Table1 which makes the required changes to Table2 and Table3.
Aug 8 '08 #6
Call a function on the event in Table1 which makes the required changes to Table2 and Table3.
Thats an easy solution yes, but I am looking to call an event in Table1 and then, dynamically, any other object can listen and grab it.

So all Table2 and Table3 would have to do, is to listen to Table1. "Assign" themselves to it.

I´m sorry if this is confusing.
Thanks for the help, so far:)
Aug 8 '08 #7
acoder
16,027 Expert Mod 8TB
What you're looking for is Mutation Events. Unfortunately, support for it is currently poor in all browsers. In the meantime, either go for the easy alternative above or poll the DOM using setInterval.
Aug 8 '08 #8
What you're looking for is Mutation Events. Unfortunately, support for it is currently poor in all browsers. In the meantime, either go for the easy alternative above or poll the DOM using setInterval.
Ok I see.
Thanks for all the help:)
Aug 11 '08 #9
acoder
16,027 Expert Mod 8TB
No problem, you're welcome.

Just out of interest, what did you choose to do in the end?
Aug 11 '08 #10

Sign in to post your reply or Sign up for a free account.

Similar topics

1
Frinavale
by: Frinavale | last post by:
Introduction I've seen many questions asked about how to disable the browser's back button and in the past I've replied with "it's simply not possible". It's not a good idea to disable the back...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
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
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.