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

  • Home
  • SEARCH
  • 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 1026639
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:06:50+00:00 2026-05-16T12:06:50+00:00

I am using fluent NHibernate with WebForms and I am trying to build a

  • 0

I am using fluent NHibernate with WebForms and I am trying to build a page where I allow a user to post a status update on their profile page and I a using a .asmx WebService to post the data to the database and then returnig a StatusUpdate instance to the page to be used by jQuery. I have a couple problems.

1) First off when I return a string from the WebService(i was testing) the textbox where the user enters their status doesnt empty the contents. And since the page doesnt refresh even if I manally clear out the textbox and put in something else, it still posts the previous status to the database again. How do I fix this?

2) Secondly, when I return the StatusUpdate Object from the Webservice I cant the results to display anything. Like I sad, Im using jQuery to make an AJX call to the WebService.

Here is my code:

User Profile Page Javascript:

    var status1 = $("#statusBox").val();
    var userID = $("#MainContent_userID").val();
    function SetStatus() {
        $.ajax({
            type: "POST",
            url: "http://localhost/Sports/Services/UserWebService.asmx/SetStatus",
            data: '{"status": "' + status1 + '", "userID": "' + userID + '"}',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: OnSuccess,
            error: OnError
        });
    }
    function OnSuccess(response) {
        $("#statusBox").empty();
                $("#MainContent_status").html(response.Status).fadeIn(1000);  
            }

    function OnError(request, status, error) {
                alert(request.statusText);
            }

WebService:

[WebService(Namespace = "Sports.Services")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)] 
[System.Web.Script.Services.ScriptService]
public class UserWebService : System.Web.Services.WebService
{
    private IUserSession _userSession;
    public ISession Session1
    {
        get { return NHibernateSessionModule.GetCurrentSession(); }
    } 

    [WebMethod]
    public StatusUpdate SetStatus(string status, Guid userID)
    {
        _userSession = ObjectFactory.GetInstance<IUserSession>();
        StatusUpdate update = new StatusUpdate();
        update.StatusDateTime = DateTime.Now;
        update.StatusLikes = 0;
        update.UserID = userID;
        update.Status = status;
        Session1.SaveOrUpdate(update);
        return update;
    }
}

Any help would be greatly appreciated… Ive looked at probably 100 pages trying to find an answer and none have worked..

  • 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-05-16T12:06:51+00:00Added an answer on May 16, 2026 at 12:06 pm

    For #1, you need to move the .val() calls inside the method so they’re fetched at the correct time, like this:

    function SetStatus() {
        var status1 = $("#statusBox").val();
        var userID = $("#MainContent_userID").val();
        $.ajax({
            type: "POST",
            url: "http://localhost/Sports/Services/UserWebService.asmx/SetStatus",
            data: '{"status": "' + status1 + '", "userID": "' + userID + '"}',
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: OnSuccess,
            error: OnError
        });
    }
    

    Though you should consider making this as an object and using .stringify to handle any special characters.


    For #2, asmx web services like to wrap the object, so it doesn’t look like this:

    { "Status": "My Status", "UserID": 12, "StatusLikes": 0..... }
    

    It actually looks like this:

    { "d": { "Status": "My Status", "UserID": 12, "StatusLikes": 0..... } }
    

    So instead of this:

    $("#MainContent_status").html(response.Status).fadeIn(1000);
    

    You need this:

    $("#MainContent_status").html(response.d.Status).fadeIn(1000);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to automap my domain model using fluent nhibernate. In this particular
I'm trying to get logging enabled on my application using Fluent NHibernate and log4net.
I am trying to set up proper domain architecture using Fluent NHibernate and Linq
I'm trying to do a join like this using fluent nhibernate: Id(x => x.Id);
I've just started using Fluent NHibernate and have run into the following problem trying
I'm using Fluent NHibernate (the NH3 build - #694) and LINQ to connect to
I'm using Fluent-Nhibernate version 1.3 and I'm trying to make a query envolving 5
Our MVC3 application is using Fluent NHibernate and requires implementation of user login, authentication
I am using Fluent Nhibernate 1.0 with Sharp Architecture 1.0 Currently I am trying
I have 3 classes that I'm trying to map using fluent nHibernate, but I've

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.