Skip to content Skip to sidebar Skip to footer

I Am Trying To Get The Input Of A Javascript Textbox Saved Back To Server. I Want To Get The Input From The Pop Up Textbox Saved To Rename A Folder.

I am trying to pass the value of a javascript textbox to the server using an asp.net hidden field. Not sure what to do in code behind to save submitted value. $(function () { $(':

Solution 1:

In your code behind (C#) code (it should be the .CS class that matches your page name) create (if not already exist) a function handling the click event "btnCopy_Click" There you can put your code to update the folder creation. Use the IO library to do that... I will look for an example for you

Solution 2:

So here is how i finally got this to work. jQuery referenced the hidden field and i called it in code behind to pass the value. Thanks Alot to User AhmedGadir for all his help.

    $(function () {
$(":asp(btnCopy)").live("click", function (e) {
    e.preventDefault();
    $("<div></div>").dialog({
        resizable: false,
        modal: true,
        title: "Do you want to rename this folder?",
        height: 100,
        width: 300,
        buttons: {
            "Yes": function () {
                $(this).dialog('close');
                var name = window.prompt("Please enter new folder name", "");
                $(":asp(newFolderName)").prop('value', name);
                __doPostBack($(":asp(btnCopy)").prop('name'));

            },
            "No": function () {
                $(this).dialog('close');
                alert("Folder saved without rename");
                __doPostBack($(":asp(btnCopy)").prop('name'));
            },
            "Cancel": function () {
                $(this).dialog('close');
            }
        }
    });
});

});

string folderName = newFolderName.Value;

Post a Comment for "I Am Trying To Get The Input Of A Javascript Textbox Saved Back To Server. I Want To Get The Input From The Pop Up Textbox Saved To Rename A Folder."