Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vb.net/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
.net 如何动态添加新的文本框和dropdownlist,并将它们保存到sql数据库中的多行中?_.net_Vb.net - Fatal编程技术网

.net 如何动态添加新的文本框和dropdownlist,并将它们保存到sql数据库中的多行中?

.net 如何动态添加新的文本框和dropdownlist,并将它们保存到sql数据库中的多行中?,.net,vb.net,.net,Vb.net,我陷入这个问题已经有一段时间了。我已经在谷歌上搜索过了,但是他们都使用javascript。如何将多个值保存到数据库中的多行 </table> <br /> <input id="Button2" type="button" value="Tambah" onclick="addRow('data')" style="border: thin ridge #000000" /> <asp:Label ID="Lab

我陷入这个问题已经有一段时间了。我已经在谷歌上搜索过了,但是他们都使用javascript。如何将多个值保存到数据库中的多行

    </table>


    <br />
    <input id="Button2" type="button" value="Tambah" onclick="addRow('data')" style="border: thin ridge #000000"  />

    <asp:Label ID="Label3" runat="server" Text="Proses" Visible="False"></asp:Label>
    <br />

    <br />
<asp:Button ID="send" runat="server" Text="Hantar" BorderColor="Black" Width="60px" OnClick="Send_Click" />
    <asp:Button ID="clear" runat="server" Text="Semula" BorderColor="Black" Width="60px" OnClick="Semula_Click"/><br />
这是我的密码:

<SCRIPT language="javascript">

   function addRow(data) {

       var table = document.getElementById(data);

       var rowCount = table.rows.length;
       var row = table.insertRow(rowCount);

       var colCount = table.rows[0].cells.length;

       for (var i = 0; i < colCount; i++) {

           var newcell = row.insertCell(i);

           newcell.innerHTML = table.rows[0].cells[i].innerHTML;
           //alert(newcell.childNodes);
           switch (newcell.childNodes[0].type) {
               case "text":
                   newcell.childNodes[0].value = "";
                   break;
               case "checkbox":
                   newcell.childNodes[0].checked = false;
                   break;
               case "select-one":
                   newcell.childNodes[0].selectedIndex = 0;
                   break;
           }
       }
   }


</SCRIPT>

<table style="width: 100%;"><tr><td><h3 style="text-decoration: underline"></h3></td></tr></table>
    <table style="width: 100%;" rules="all">
        <tr>
            <td style="width: 100px">Stokereta</td>
            <td style="width: 80px">Jenis Roda</td>
            <td style="width: 100px">No Siri</td>
            <td style="width: 80px">Saiz Roda (mm)</td>
            <td style="width: 50px">Flange (mm)</td>
            <td style="width: 50px">Hollow (mm)</td>
            <td style="width: 100px">Tindakan</td>
            <td style="width: 100px">Skidded</td>
            <td style="width: 350px">Catatan</td>

        </tr>
        </table>


        <table style="width: 100%;" id="data" rules="all">
        <tr>
            <td >
                <asp:TextBox ID="stokereta" runat="server" Width="100" BorderStyle="None" ></asp:TextBox>
            </td>
            <td>
                <asp:DropDownList ID="ddl_jenisroda" runat="server" Width="80" >
                </asp:DropDownList>

            </td>
            <td>
                <asp:TextBox ID="nosiri" runat="server" Width="100" BorderStyle="None" ></asp:TextBox>

            </td>
            <td>
                <asp:TextBox ID="saizroda" runat="server" Width="80" BorderStyle="None" ></asp:TextBox>
            </td>
            <td>
                <asp:TextBox ID="flange" runat="server" Width="50" BorderStyle="None" ></asp:TextBox>
            </td>

            <td>
                <asp:TextBox ID="hollow" runat="server" Width="50" BorderStyle="None" ></asp:TextBox>
            </td>
            <td>
                <asp:DropDownList ID="ddl_tindakan" runat="server" Width="100" >
                <asp:ListItem>Pilih..</asp:ListItem>
                <asp:ListItem>Reprofiling</asp:ListItem>
                <asp:ListItem>Rediscing</asp:ListItem>
                </asp:DropDownList>


            </td>
            <td>
                <asp:DropDownList ID="ddl_skid" runat="server" Width="100" >
                <asp:ListItem>Pilih..</asp:ListItem>
                <asp:ListItem>Ya</asp:ListItem>
                <asp:ListItem>Tidak</asp:ListItem>
                </asp:DropDownList>
            </td>
    </table>


    <br />
    <input id="Button2" type="button" value="Tambah" onclick="addRow('data')" style="border: thin ridge #000000"  />

    <asp:Label ID="Label3" runat="server" Text="Proses" Visible="False"></asp:Label>
    <br />

    <br />
<asp:Button ID="send" runat="server" Text="Hantar" BorderColor="Black" Width="60px" OnClick="Send_Click" />
    <asp:Button ID="clear" runat="server" Text="Semula" BorderColor="Black" Width="60px" OnClick="Semula_Click"/><br />

人们不太可能想看所有这些代码。我不是ASP.Net专家,但据我所知,我想肯定有人会需要这样的东西,而且网上有很多关于以友好方式添加控件的页面,像这样:ok抱歉madth3..实际上我想动态添加文本框和下拉列表到我的表单中。用户将输入数据(7个文本框和2个下拉列表)。这是1行..在我的情况下,用户将添加新行以输入更多数据..所以基本上如何添加多个文本框和下拉列表,然后将它们保存到多行数据库中(为了便于以后实现)。我在javascript中找到了很多代码,建议添加txtbox。但是如果使用javascript,我不知道如何插入sql数据库。我添加的链接似乎没有使用javascript,它确实提到了持久性。搜索时,请确保使用术语“asp.net”和“控件”.但我想知道如何在sql数据库的多行中插入多个值..你知道怎么做吗?