开发者

How to get value of data send by post method in asp.net

开发者 https://www.devze.com 2023-03-17 01:15 出处:网络
I have a .aspx page which contains form. I am setting another page at the 开发者_Go百科action event of the form. Now I want to send data from one aspx form to another aspx form via post method. How ca

I have a .aspx page which contains form. I am setting another page at the 开发者_Go百科action event of the form. Now I want to send data from one aspx form to another aspx form via post method. How can I access those data on second form??? I am sending data through JQuery.

<script language="javascript" type="text/javascript" >
    //debugger;
    // $(document).ready(function() {
    //   alert('hello there');
    //});
    function test() {

        $("#test").load("test.aspx").toggle();
        // alert($("#frm").serialize());
        // var txt = '<%= Hidden1 %>';
        var txt = document.getElementById('<%= Hidden1.ClientID %>').value;
        alert(txt);
        //  return false;
        $.post("test.aspx", document.getElementById("<%= frm.ClientID %>").serialize,  function(data) {
            alert(data);
        });
            /*$.post("test.aspx",
            {
                name: txt
            },
            function(data) {
                alert(data);
            });*/
        return false;
    }
 </script>


Use : Request.Form["username"]

where "username" are the Names of the controls on the posting page.


There is another way, you can set a button's post back url property to the url of the second page, and in the second page you can get all the elements of the first page from the Page.PerviosPage object Example

TextBox txt = 
                (TextBox)Page.PreviousPage.FindControl("serverNameText");
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号