• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 84
  • Last Modified:

How do I get my serialized data into a label or text box or other control?

I just want to get the data that I serialized using jQuery into something that I can process. I've been unsuccessful so far.

jQuery & HTML
        $(document).ready(function () {
            $("#sortable").sortable({
                // code to run when the order is updated
                update: function (event, ui) {
                    // get the order of the items in the list
                    var data = $(this).sortable('serialize');
                    // pass the data back to your server for processing
                    $("#dataInnerHTML").text(data);
                }
            });

            $(function () {
                // this initializes the dialog (and uses some common options that I do)
                $("#dialog").dialog({ autoOpen: false, modal: true, show: "blind", hide: "blind" });

                // next add the onclick handler
                $("#contactUs").click(function () {
                    $("#dialog").dialog("open");
                    return false;
                });
            });
        });    
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div runat="server" id="sortable"> </div>
    <div runat="server" id="data" class="data">
        <asp:Label ID="dataInnerHTML" runat="server" />
    </div>
    <asp:Button ID="btnGetDivInnerHTML" runat="server" OnClick="btnGetDivInnerHTML_Click" />
    <a href="#" id="contactUs" runat="server">Contact Us</a>
    <div id="dialog" title="Contact form">
        <p>
            appear now</p>
    </div>
    </form>
</body>
</html>

Open in new window


C#
        protected void btnGetDivInnerHTML_Click(object sender, EventArgs e)
        {
            string strInnerHTML = "";
            string[] strText = new string[5];

            //dataInnerHTML.Text = dataInnerHTML.Text + "_VICTORY";

            strText[0] = dataInnerHTML.Text;
        }

Open in new window

0
Michael Sterling
Asked:
Michael Sterling
  • 3
1 Solution
 
Mihai StancescuSoftware Engineer Commented:
Hi,

What type of data is serialized when passed to the server?

On the server you can deserialize the string data using new System.Web.Script.Serialization.JavaScriptSerializer().Deserialize<customclass>(dataInnerHTML.Text);

Hope this helps,
Mishu
0
 
Michael SterlingWeb Applications DeveloperAuthor Commented:
@Mihai Stancescu: What is the "<customclass>" part of that call? What goes there?
0
 
Michael SterlingWeb Applications DeveloperAuthor Commented:
I was able to solve this with help elsewhere. See thread ID: 28640818. Thanks.
0
 
Michael SterlingWeb Applications DeveloperAuthor Commented:
I was able to solve this elsewhere. See thread ID: 28640818.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now