如何从vb.net后面的代码提交Javascript / jquery表单值? [英] How to submit Javascript/jquery form values from code behind vb.net?

查看:61
本文介绍了如何从vb.net后面的代码提交Javascript / jquery表单值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个javascript函数,可以在按钮点击时打开弹出窗体。我需要帮助,当用户点击提交时,它需要触发我的vb代码以将数据插入我的数据库。

我还需要帮助提交按钮来触发事件。我在javascript中这样做吗?或者在我的表格中的表格上?

我没有使用jquery的弹出窗口,所以任何帮助都会受到赞赏,或者以不同的方式完成此任务。

Code下面:



 < script    类型  =  text / javascript    src   =  http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js >  < /   script  > ;  
< script src = http:/ /ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js\" type = text / javascript > < / script >
< link href = http://ajax.aspnetcdn.com/ajax/ jquery.ui / 1.8.9 / themes / start / jquery-ui.css
rel = stylesheet type = text / css />

< script type = text / javascript >
$( [id * = RegisterButton1])。live( 点击 function (){
$( #modal_signup1)。dialog({
width:< span class =code-comment>' 325',
height:' 500',
title: 在这里开始你的30天试用
按钮:{
关闭: function (){
$(this).dialog(' close') ;
},
提交: function (){
$(this).dialog(' submit');
}
},
modal: true
});
return false;
});
< / script >

< asp:按钮ID = RegisterButton1 runat = server Text = 立即注册! />

< div id = modal_signup1 style = display:none; font-family:calibri;>
< table style = font-family:calibri; font-size:small; font-weight:粗体
align = center>
< tr>
< td>
NPN号码:
< / td >
< td>
< asp:TextBox ID = TextBox1 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入您的NPN号码(您将使用此号码登录)> < ; / asp:TextBox >
< / td >
< / tr >
< tr> ;
< td>
密码:
< / td >
< td>
< asp:TextBox ID = TextBox2 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入密码(您将使用此登录)> < / asp:TextBox >
< / td >
< / tr >
< tr>
< td>
名字:
< / td >
< td>
< asp:TextBox ID = TextBox3 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入您的名字> < / asp:TextBox >
< / td >
< / tr >
< tr>
< td>
MI:
< / td >
< td>
< asp:TextBox ID = TextBox4 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入您的中间名> < / asp:TextBox >
< / td >
< / tr >
< tr>
< td>
姓氏:
< / td >
< td>
< asp:TextBox ID = TextBox5 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入您的姓氏> < / asp:TextBox >
< / td >
< / tr >
< tr>
< td>
地址:
< / td >
< td>
< asp:TextBox ID = TextBox6 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入您的地址> < / asp:TextBox >
< / td >
< / tr >
< tr>
< td>
城市:
< / td >
< td>
< asp:TextBox ID = TextBox7 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入你的城市> < / asp:TextBox >
< / td >
< / tr >
< tr>
< td>
状态:
< / td >
< td>
< asp:DropDownList ID = DropDownList1 runat = server>
< asp:ListItem Value = NC Selected = True> North Carolina < / asp:ListItem >
< / asp:DropDownList >
< / td >
< ; / tr >
< tr>
< td>
邮编:
< / td >
< td>
< asp:TextBox ID = TextBox8 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入您的邮政编码> < / asp:TextBox >
< / td >
< / tr >
< tr>
< td>
县:
< / td >
< td>
< asp:DropDownList ID = countylist runat = server DataSourceID = SqlDataSource2
DataTextField = county DataValueField = county>
< / asp:DropDownList >
< / td >
< / tr >
< tr>
< td>
电话:
< / td >
< td>
< asp:TextBox ID = TextBox9 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入您的电话号码> < / asp:TextBox >
< / td >
< / tr >
< tr>
< td>
传真:
< / td >
< td>
< asp:TextBox ID = TextBox10 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入您的传真号码> < / asp:TextBox >
< / td >
< / tr >
< tr>
< td>
电子邮件:
< / td >
< td>
< asp:TextBox ID = TextBox11 runat = server rel = 工具提示 data-placement = bottom ToolTip = 输入您的电子邮件> < / asp:TextBox >
< / td >
< / tr >
< tr>
< td colspan = 2>
安全问题:< br />
2 + 3是什么? < asp:TextBox ID = TextBox12 runat = server Width = 50 > < / asp:TextBox >
< / td >
< / tr >
< tr>
< td colspan = 2>
< asp:按钮ID = SubmitButton runat = server Text = 立即开始我的试用!
onclientclick = 返回确认('立即注册? ') OnClick = SubmitButton_Click />
< / td >
< / tr >
< tr>
< td>

< / td >
< td>

< / td >
< / tr >
< / table >
< / div >

解决方案

[id * = RegisterButton1])。live( 点击 function (){


#modal_signup1)。dialog({
width:' 325 ',
height:' 500',
title: 在这里开始30天试用
按钮:{
关闭: function (){


(this).dialog(' close');
},
提交: function (){

I have a javascript function that opens a popup form on button click. I need help with when user clicks "submit" it needs to fire my vb code behind to insert the data into my database.
I also need help with the submit button to fire the event. Do I do this in the javascript? or on the form in my table?
I haven't used popups much with jquery, so any help would be appreciated, or a different way to accomplish this.
Code Below:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/jquery-ui.js" type="text/javascript"></script>
<link href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.9/themes/start/jquery-ui.css"
    rel="stylesheet" type="text/css" />

<script type="text/javascript">
    $("[id*=RegisterButton1]").live("click", function () {
        $("#modal_signup1").dialog({
            width: '325',
            height: '500',
            title: "Start Your 30 Day Trial Here",
            buttons: {
                Close: function () {
                    $(this).dialog('close');
                                },
                                Submit: function () {
                                    $(this).dialog('submit');
                                }
            },
            modal: true
        });
        return false;
    });
</script>

<asp:Button ID="RegisterButton1" runat="server" Text="Register Now!" />

<div id="modal_signup1" style="display: none; font-family: calibri;">
<table style="font-family: calibri; font-size: small; font-weight: bold" 
        align="center">
<tr>
<td>
NPN Number:
</td>
<td>
    <asp:TextBox ID="TextBox1" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter Your NPN Number (You Will Use This To Login)"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Password:
</td>
<td>
    <asp:TextBox ID="TextBox2" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter a Password (You Will Use This To Login)"></asp:TextBox>
</td>
</tr>
<tr>
<td>
First Name:
</td>
<td>
    <asp:TextBox ID="TextBox3" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter Your First Name"></asp:TextBox>
</td>
</tr>
<tr>
<td>
MI:
</td>
<td>
    <asp:TextBox ID="TextBox4" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter Your Middle Initial"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Last Name:
</td>
<td>
    <asp:TextBox ID="TextBox5" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter Your Last Name"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Address:
</td>
<td>
    <asp:TextBox ID="TextBox6" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter Your Address"></asp:TextBox>
</td>
</tr>
<tr>
<td>
City:
</td>
<td>
    <asp:TextBox ID="TextBox7" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter Your City"></asp:TextBox>
</td>
</tr>
<tr>
<td>
State:
</td>
<td>
    <asp:DropDownList ID="DropDownList1" runat="server">
    <asp:ListItem Value="NC" Selected="True">North Carolina</asp:ListItem>
    </asp:DropDownList>
</td>
</tr>
<tr>
<td>
Zip:
</td>
<td>
    <asp:TextBox ID="TextBox8" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter Your Zip Code"></asp:TextBox>
</td>
</tr>
<tr>
<td>
County:
</td>
<td>
    <asp:DropDownList ID="countylist" runat="server" DataSourceID="SqlDataSource2" 
        DataTextField="county" DataValueField="county">
    </asp:DropDownList>
</td>
</tr>
<tr>
<td>
Phone:
</td>
<td>
    <asp:TextBox ID="TextBox9" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter Your Phone Number"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Fax:
</td>
<td>
    <asp:TextBox ID="TextBox10" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter Your Fax Number"></asp:TextBox>
</td>
</tr>
<tr>
<td>
Email:
</td>
<td>
    <asp:TextBox ID="TextBox11" runat="server" rel="ToolTip" data-placement="bottom" ToolTip="Enter Your Email"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
Security Question:<br />
What is 2+3? <asp:TextBox ID="TextBox12" runat="server" Width="50"></asp:TextBox>
</td>
</tr>
<tr>
<td colspan="2">
    <asp:Button ID="SubmitButton" runat="server" Text="Start My Trial Now!"  
        onclientclick="return confirm('Register Now?')" OnClick="SubmitButton_Click" />
</td>
</tr>
<tr>
<td>

</td>
<td>

</td>
</tr>
</table>
</div>

解决方案

("[id*=RegisterButton1]").live("click", function () {


("#modal_signup1").dialog({ width: '325', height: '500', title: "Start Your 30 Day Trial Here", buttons: { Close: function () {


(this).dialog('close'); }, Submit: function () {


这篇关于如何从vb.net后面的代码提交Javascript / jquery表单值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆