开发者

How to get the data from an HTML page and store it into SQL Sever

开发者 https://www.devze.com 2023-03-21 04:43 出处:网络
I have my a HTML page) where user will have to login first. My question is how can i get the value of the TextBox from that HTML page to a ASP.开发者_开发百科NET page?

I have my a HTML page) where user will have to login first.

My question is how can i get the value of the TextBox from that HTML page to a ASP.开发者_开发百科NET page?

P.S. Will Request.Form() method will work??


Request.Form[] will work as long as your html page has the inputs within a form that posts to a page on your asp.net application.


Try to create a javascript function which gets the values of the textboxes in html form and pass them as query string for the page you are redirecting.

in javascript:

function Text(textbox) {
            var btn = document.getElementById('btnSubmit');
            var text = document.getElementById(textbox.id);
            btn.href = btn.href +'?'+ text.value;
        }

in html page:

<form id="form1" runat="server">
    <div>
      Text:  <input id="txtBox" type="text" onchange="Text(this);" />
        <a id="btnSubmit" href="Default.aspx">Submit</a>
    </div>
 </form>

So, when you click Submit u'll find the link with query string like this :

http://localhost/Test/Default.aspx?test

Mark as answer if it helps!

0

精彩评论

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