Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9056699
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T14:16:31+00:00 2026-06-16T14:16:31+00:00

SOLVED : Added the new corrected lines of code and commented the old ones.

  • 0

SOLVED:

Added the new corrected lines of code and commented the old ones.


For a real-time application using SignalR, i want changes made by a user to be visible in real-time by all the connected clients.

It’s ok with a simple textbox, but when i use a dropdown list: when a user select an item, i want the selected item from dropdown to be automatically set (auto-updated) to all connected clients.

Knockout.js seems to be the obvious choice, but i think i have a problem on subscribe… or elsewhere?

What i have:

(ASP .NET Razor) Dropdown:

//@Html.DropDownListFor(model => model.UserProfile.UserId, (SelectList)ViewBag.DDLUsersId, "Select User", new { @class = "ui-corner-all", @data_bind="value: selectedResponsible_UserId" })

@Html.DropDownListFor(model => model.UserProfile.UserId, (SelectList)ViewBag.DDLUsersId, "Select User", new { @class = "ui-corner-all", @data_bind="value: Responsible_UserId" })

(HTML) which generates:

//<select class="ui-corner-all" data-bind="value: selectedResponsible_UserId" id="UserProfile_UserId" name="UserProfile.UserId"><option value="">Select User</option>

<select class="ui-corner-all" data-bind="value: Responsible_UserId" id="UserProfile_UserId" name="UserProfile.UserId"><option value="">Select User</option>
    <option value="1">test1</option>
    <option value="2">test2</option>
</select>

(JavaScript) ViewModel:

function taskViewModel(id, title, Responsible_UserId, ownerViewModel)
{
    this.taskId = id;

    this.title = ko.observable(title);

    //this.selectedResponsible_UserId = ko.observable(Responsible_UserId);

    this.Responsible_UserId = ko.observable(Responsible_UserId);

    this.notification = function (b) { notify = b }

    var self = this;

    this.title.subscribe(function (newValue) 
    {
        ownerViewModel.updateTask(ko.toJS(self));
    });

    //this.selectedResponsible_UserId.subscribe(function (newValue) 

    this.Responsible_UserId.subscribe(function (newValue) 
    {
        ownerViewModel.updateTask(ko.toJS(self));
    });
}

(JavaScript) Function from Client-Side which call the function from Server-Side with specified object:

this.updateTask = function (task)
{    
    if (notify) 
        this.hub.server.s_Update(task);
}

(C#) Function from Server-Side which modify values in DB and call the function from Client-Side for all the connected Clients with specified object:

public bool S_Update(Task updatedTask)
{
    using (var context = new ToDoDbContext())
    {
        var oldTask = context.Tasks.FirstOrDefault(t => t.taskId == updatedTask.taskId);

        if (oldTask == null)
            return false;
        else
        {
            oldTask.title = updatedTask.title;

//??? Here, value 'updatedTask.Responsible_UserId' was NULL !!!
            oldTask.Responsible_UserId = updatedTask.Responsible_UserId;

            context.SaveChanges();

            Clients.All.C_TaskUpdated(oldTask);

            return true;
        }
    }
}

(JavaScript) Function from Client-Side which should update the Interface:

this.hub.client.C_TaskUpdated = function (t)
{
    var task = ko.utils.arrayFilter(tasks(), function (value) { return value.taskId == t.taskId; })[0];

    notify = false;
        task.title(t.title);    

//!! obvious, here was set to NULL.     
        //task.selectedResponsible_UserId(t.Responsible_UserId);

        task.Responsible_UserId(t.Responsible_UserId);
    notify = true;
};
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T14:16:32+00:00Added an answer on June 16, 2026 at 2:16 pm

    If I follow this correctly, your prop is called selectedResponsible_UserId on the client-side and Responsible_UserId on the server. Looks like this potential mismatch is causing your issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to have a dynamic table, with rows added over time as a
I want to create a qt application ( using qt-creator ), that use my
SOLVED: added some java to the Page 1 code to read the URL parameters
Solved Hi currently im using SimpleXLSX to parse the xlsx (excel file), all the
SOLVED. Code has been edited to reflect solution. Given the following GridView : <asp:GridView
Using Visual Studio I have a Class Library (C#) where I added a reference
EDIT: Solved with a hack for now. Added at line 473: if (isset($this->_termsFreqs[$termId][$docId])) {
I have a pretty standard Java Desktop Application in NetBeans. I recently added a
In the course of developing my Android application, I noticed that the following lines
I want to perform a big insert statement on multiple lines, but recursion is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.