How To 'subscribe' To An Event That Ripples To Client

Aug 30, 2010

i can use javascript setInterval() (in combination with jquery ajax) to 'poll' the controller action in order to determine if something 'new' should be renedered onto the page. However, I'm not a huge fan of polling, especially when client browsers can be left unattended and are uneccessarily polling for changes.

Multiply that by the number of potential client machines that could be browsing the app and you get a feel for the scale of the issue with this approach. Now, in truth, this is EXACTLY the approach that I use to refresh certain page fragments on some ('read' - MANY!!) of my existing sites.

However, I'd like to know what the options are for subscribing in 'reverse' to events and having the controller 'know' about the client browser and any events that it is subscribed to and the controller then 'push' out the update to the client on a 'needs must' basis. Is this something that happens outside of the normal desktop events scenario?

View 2 Replies


Similar Messages:

Why Event Bubbling And Why Not Directly Subscribe The Click Event

Jul 2, 2010

I was going through an article on event bubbling in asp.net and came to know that although it is possible to subscribe to the click event of a user control's button from the containing page, "doing so would break some of the object oriented rules of encapsulation". A better idea is to publish an event in the user control to allow any interested parties to handle the event.

My question is that exactly how does a direct subscription to the button's click event from a containing page would break the object oriented rules of encapsulation?

View 2 Replies

Web Forms :: Subscribe To A Web Control Event?

Mar 1, 2010

how to go about retrieving data from another control by subscribing to an even and receiving back results at a later time. I'm trying to see if there is a way to have one web control (Main control), subscribe to an event in another web control (Search control), by maybe only sending in a method within the main web controls class. Once a query event occurs (via Button click) in the search web control, it sends back results to that original function in the Main Web Control (returning a datatable)

I think the goal is to have the search control be unaware of the main control and any specific methods or classes. Only have classes subscribe it it. Kind of like a top down process only. Is there any method that can work to accomplish this? I've looked into delegate methods and EventHandler (EventArgs) methods, but can't clearly see how this could apply.

View 4 Replies

Data Controls :: Handle ItemCommand Event When Loading Event From Repeater From Client Side?

Jan 24, 2016

[URL] how to handle item command event in above  example?

View 1 Replies

Subscribe To Rss And Then Save The Content Into A Db?

Aug 5, 2010

I want to write a page that shows the content of an rss feed. But I dont want to show only the current rss info but also previous. In other words I want to store every rss feed from the second I will finish building this page. The old and bad method is to refresh every 1 min or so, and compare the rss list to the db list. The rsses that doesnt showen on the db will be inserted.This method looks bad to me and I want some automatic method. What I mean is that when a new feed is posted it will send it to me (as a subscriber) and then it will inserted into the db.

How do I do it? And how do I do it behined the seance (in the global.asax or something?)?

View 2 Replies

C# - Add Subscribe Button To Feed Webpage?

Oct 29, 2010

I have built an RSS feed and consume it in asp.net page.

In this page i want add a button that enables users to subsribe to the feed so that they stay updated with news(and informed).

View 2 Replies

Using WCF Callback And Web Application To Implement Publish/subscribe Pattern?

Mar 1, 2011

I'm trying to use WCF Callback to implement publish/subscribe pattern. I would like to send the message from UserA to UserB or UserA to every clients at the moment. I got an example from here

In my app, I use asp.net as a client to connect wcf service instead and I found a problem when I subscrib to wcf service.

The wcf service does not hold any other clients object. So when I call GetAllClients(_guid), It will return only 1 client which is itself.

Here is the code in asp.net page (i put every control inside updatePanel)

[code]...

Is it possible to implement this publish/subscribe with asp.net and wcf callback? (I already tried on window app and it worked fine)If it is possible, how can I keep all clients that is connecting to WCF Service so I can use those GuId to call callback method.

View 1 Replies

C# - How To Subscribe To Page Events In Visual Studio 2008 IDE

Feb 12, 2011

IMPORTANT Can any body solve this one ?How to create page's Init, Load, PreRender etc. event handlers in VS 2008? When we double click on the page, it will create Page_Load event. How to create othere events of page? I am using c# in ASP.NET application. There is no Event tab in image.

View 4 Replies

Web Forms :: How To Fire Server Side Event After Client Side Event Is Triggered

Sep 12, 2012

I have a scenario where i have 4 asp buttons , on click of each button there are 4 labels inside 4 seperate divs where each displays seperate data.

Now if i click second button i need to display second label text inside 2nd div and hide all other divs.How can i achieve this ?

 OnClientClick event of each button calls displayAlternate() which displays repective div and hides other.

displayAlternate('second'); return false; --> if i do this server side event is not fired ...

If I return true div second label is not getting displayed..

How can I achieve functionality where all divs expect 2nd is hidden and i get server side event also..

Below is code.

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head><body>
<form id="form1" runat="server">
<script type="text/javascript">
function displayAlternate(id) {

[Code] .....

View 1 Replies

RadioButton Client Event Not Triggering?

Apr 22, 2010

I'm dynamically generating radio buttons in my code behind and assigning javascript to them as they are created. This javascript will change the value in a hidden field for when a postback is eventually triggered (autopostback on the buttons is disabled). I am using the exact same method with ASP ImageButtons and it works fine but when I do it with the radio buttons the event never triggers the Javascript. I suspect that I may be using the wrong event name but I have tried several (onclick, onCheckedChanged, etc).

Here is a sample of the VB.NETcode - how come this works fine with my button but not my radiobutton!

//This is my hidden field
ClientScript.RegisterHiddenField(Me.UniqueID & "_someVariable", "")
Dim radDefault As RadioButton = New RadioButton()
radDefault.GroupName = "radio buttons"
radDefault.AutoPostBack = False
//This adds the Javascript to set the hidden field with an onClick event
radDefault.Attributes.Add("onClick", "document.forms[0]." & Me.UniqueID & "_someVariable.value='0';document.forms[0].submit();")

The code is simplified as the button generation is actually through an iterator but the same properties are given to each generated radio button.

View 1 Replies

Fire Server Event From Client?

Nov 9, 2010

I am having trouble with the Asp.net page life cycle. I am trying to create a custom menu using HtmlTextWriter with an asp.net LinkButton to fire a server event. I can not get the server event to fire and I get the 'object reference not set to instance of object' when I click my linkbutton. Here is some code.

protected string CreateModuleMenu()
{
var modules = ModuleManager.GetModulesByDeveloperId(Developer.DeveloperID);
StringWriter sw = new StringWriter();
ClientScriptManager cs = Page.ClientScript;

[Code]....

View 1 Replies

Web Forms :: How To Client Side Event Handling

Sep 8, 2010

i should handle a event whn my focus chages from one text box to other....[ i should get an error as you are not entered the data(it should accept only numbers) ]

View 10 Replies

AJAX :: How To Load Data From Client Click Event

Aug 26, 2010

I have a Ajax Accordion control on my page with treeview in Content Template. As the treeview for each pane are big. I am wondering whether I can load the treeview from codebehind only after the pane is selected. I can reuse the code from ItemDataBound of Accordion control.

View 3 Replies

AJAX :: Finding Accordion Pane Client Event?

Nov 20, 2010

I have problem with accordion pane client side events and found this solutions on old posts:

function accSelectedChange(sender, eventArgs) {
f (eventArgs.get_propertyName() ==
"SelectedIndex")
{
alert(sender.get_ClientState());
}
}
function pageLoad() {
$object('accObjekt_AccordionProperties').propertyChanged.add(accSelectedChange);
}

[Code]....

View 1 Replies

Web Forms :: ASP.NET Validation Controls Are Removing Client Event Handlers.

Nov 24, 2010

The textbox has an onblur event (the workings of the onblur event are irrelevant), and an associated RequiredFieldValidator. This code functions exactly as it should. However,if in the body onload event I simply raise an alert of the innerHTML of tr1 or td1, the onblur event does not appear (but it does work, and can be seen when I view source in IE7). If I remove the RequiredFieldValidator, the onblur event handler is shown in the alert, or if I retain the validator but change onblur to onfocus, then the event handler also appears in the alert. I need this to work as when the user increases the Quantity, duplicates of the table row are added (I have tried both cloneNode, and setting the innerHTML of each new table cell to that of the original, but as my alert proves, the onblur event handler is not included in what is copied). The same problem also occurs with onchange for select tags with validators. I am using Visual Studio 2008 (.Net
2), IE7 and IIS 7.

[Code]....

View 7 Replies

Capture Client Side Text Change Event For TextBox

Jun 19, 2010

I have a form that contains a TextBox. A pop up window will return a value and put it into the TextBox. when this happens, i need to populate another control. I tried "OnChange" but it was not triggered .

View 1 Replies

Javascript - Fire Event After Client Side Script Validation

Nov 10, 2010

Is there a way that I can execute a javascript function after the client side validation occurs in asp.net?I have a couple validation controls on a page and an input button with CausesValidation=true. The OnClientClick handler executes javascript before the validation runs, but i want to run some functions afterwards.

View 1 Replies

C# - Event Handler In Masterpage Accessing Controls In The Client Page?

Jan 4, 2011

I have a button on a masterpage, which when clicked, calls a method that takes an EventHandler previously saved to the viewstate, this method is on the client page, and executes it:

protected void Save_Click(object sender, EventArgs e)
{
this.SaveButtonEvent += (EventHandler)ViewState["saveEvent"];
if (this.SaveButtonEvent != null)
{
this.SaveButtonEvent(sender, e);
}
}

This then calls a very simple method on the client page:

protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = TextBox2.Text;
}

However, the value of TextBox2 is incorrect, it is the value of the text box that was set when the page loaded (or if any other item on the pages changes it), the new value is not passed.

If I add a button to the client page, that calls the Button2_Click event directly, it get's the correct value.

Is the reason I am not getting the correct value of the text box because the Event is called from the master page?

I should add, that this button is created dynamically, and the event delegate will vary, which is why I have to set it at run time. I need a way to set the delegate on a click, and persist this until it is changed again.

View 2 Replies

Two Validation Groups In A Single Button Without Client Click Event

Feb 24, 2010

In a multigrid i have validating two controls like date and amount.it is validating correctly when i press the tabevent.when i press the save button it is not validating.iam using two validations gruops and two validation summary.Then in save button i have also tried onclientclick() function with javascript it s working fine but if i give the correct value in date and amount records not saving how to over come this.

Date: ' runat="server" CausesValidation="true"
ValidationGroup="group" Width="80px" AutoPostBack="true" OnTextChanged="txtDate_TextChanged">
Amount" ' CausesValidation="true"
ValidationGroup="req" runat="server" AutoPostBack="true">
validations summary: button save: OnClick="ButtonSave_Click" TabIndex="6" />

how to validate this in the button save also two popup box should be shown

View 1 Replies

Web Forms :: Button Click Event With Client Script - Confirm With Yes / No

May 17, 2010

i have a buton with some button1_click event code. as is it works just fine, however when i add client side script, essentially a confirm with yes/no this code is not executed. how do i work around this i am using ajax i want to keep UseSubmitBehaviour to false. I am very new at this so there is a very good chance i am missing something.

View 3 Replies

Button On Client Click Event Loads Drop Down List?

Oct 6, 2010

Right now my ASP page has a text box and a submit button, what I am trying to do is once the user hits the submit button load a drop down list.

The drop down list should not be visible before the submit button is pressed

View 4 Replies

WCF / ASMX :: Invoke Web Service From Client At Body's Onunload Event

Feb 21, 2011

as part of a log feature that my client asked for, I'm tring to monitor whenever the browser is closed by the user.

I have created a new web service, registered it the ScriptManager (like in this exmple [URL]

The web method is this:

[Code]....

When I put a break point it is reached, but the executenonquery won't fired.

View 1 Replies

C# - Sending ICalendar Event To Client While Still Continue Running Code?

Oct 26, 2010

I have built a basic calendar event using DDay.iCal, when I click "Add to calendar" link I produce an event and then sends this to the client.Basically, my application works like this.

A User logs in.
Selects a specific date.
Books a specific timeslot
Clicks the "Add to calendar" link

Sending the event is done by using Response.Write() which sends the following to the client:

Response.ContentType = "text/calendar";
Response.AddHeader("Content-disposition", "attachment; filename=appointment.ics");
Response.Write(iCalString);

The above works fins but it requires me to first book the event then manually and then click the "Add to calendar" link.I want to merge the steps 3 and 4. But when trying to do so the event booking gets saved to the database but the screen does not get refreshed.Is there a "simple" way to get around this?

View 2 Replies

Adding Client Scripts For The Server Side Event GridView.OnPageIndexChanging

May 26, 2010

Is there a matching client side event that is fired before or after OnPageIndexChanging is raised? Such as the OnClientClick, I would like to append a script when the paging numbers / arrows are clicked. Is it possible, of so; how?

View 1 Replies

Javascript - Trying To Add A Client Side Event To A Dropdownlist And I Need To Access The Currently Selected Text?

Sep 1, 2010

I am trying to add a client side event to a dropdownlist and I need to access the currently selected Text. I have tried:

ddl_tech.Attributes.Add("onclick", "document.getElementById('" + chk_techreview.ClientID + "').disabled = this.options[this.selectedIndex].text.Equals(' UNASSIGNED');");
and
ddl_tech.Attributes.Add("onclick", "document.getElementById('" + chk_techreview.ClientID + "').disabled = this.text.Equals(' UNASSIGNED');");

Both of which give me runtime errors when the event is fired.Whats the correct way to access this text property client side?I tried this but it does not enable the checkbox...

ddl_tech.Attributes.Add("onchange", "document.getElementById('" + chk_techreview.ClientID + "').disabled = this.options[this.selectedIndex].text == ' UNASSIGNED';");

ANSWER:

Well, along with having to use == rather than .Equals, when you set a checkbox.enabled = false on the server side it raps the checkbox in tags and sets it to disabled=true; therefore you must set BOTH the checkbox.disabled = false and checkbox.parentElement.disabled = false; on the client side to enable the checkbox!The solution:

ddl_tech.Attributes.Add("onchange", "document.getElementById('" + chk_techreview.ClientID + "').parentElement.disabled = (this.options[this.selectedIndex].text == 'UNASSIGNED'); document.getElementById('" + chk_techreview.ClientID + "').disabled = (this.options[this.selectedIndex].text == 'UNASSIGNED');");

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved