使用SqlDataSource将数据从FormView发送到我的数据库

杰克·海洋

我的ASP.NET应用程序中有多个FormView,其中有不同的控件,例如文本框和下拉列表。

首先,在我的数据库中,我列出了具有很多详细信息的用户。在我的应用程序中,我有一个文本框,我可以在其中搜索用户,它将使用SqlDataSource填充我的一个表单视图,但是搜索时不会自动填充我的其他表单视图,这是用户将填写的部分并按提交,然后将所有数据(包括预先填充的数据)提交回数据库。

我不确定从哪里开始,如果有人可以给我一些例子或指出正确的方向,我将不胜感激。

这是我的一个FormViews的示例:

            <div class="compliant-details">
            <asp:FormView runat="server" DataSourceID="ds_complaints" CssClass="complient-details-first-section" DefaultMode="Insert">
                <InsertItemTemplate>
                    <div class="compliant-details-method">
                        <label class="applicationfont">Method:</label>
                        <asp:DropDownList class="smallinputbox" runat="server" ID="ddl_compliant_details_method" DataSourceID="ds_compliantmethod"
                            DataTextField="ComplaintMethod" DataValueField="ComplaintMethodId" AppendDataBoundItems="true">
                            <asp:ListItem Value="0" Text="<Please Select>" />
                        </asp:DropDownList>
                    </div>
                    <div class="compliant-details-type">
                        <label class="applicationfont">Type:</label>
                        <asp:DropDownList class="smallinputbox ddl" runat="server" ID="ddl_compliant_details_type" DataSourceID="ds_types"
                            DataTextField="TypeName" DataValueField="TypeId" AppendDataBoundItems="true">
                        </asp:DropDownList>
                    </div>
                    <div class="compliant-details-status">
                        <label class="applicationfont">Status:</label>
                        <asp:DropDownList class="smallinputbox" runat="server" ID="ddl_compliant_details_status" DataSourceID="ds_status"
                            DataTextField="Status" DataValueField="StatusId" AppendDataBoundItems="true">
                            <asp:ListItem Value="0" Text="<Please Select>" />
                        </asp:DropDownList>
                    </div>
                    <div class="compliant-details-catagory">
                        <label class="applicationfont">Catagory:</label>
                        <asp:DropDownList class="smallinputbox" runat="server" ID="ddl_compliant_details_catagory" DataSourceID="ds_category"
                            DataTextField="Category" DataValueField="Categoryid" AppendDataBoundItems="true">
                            <asp:ListItem Value="0" Text="<Please Select>" />
                        </asp:DropDownList>
                    </div>
                    <div class="compliant-details-recorded-by">
                        <label class="applicationfont">Recorded By:</label>
                        <asp:DropDownList class="smallinputbox" runat="server" ID="ddl_compliant_details_recorded_by" DataSourceID="ds_agents"
                            DataTextField="AgentName" DataValueField="AgentId" AppendDataBoundItems="true" />
                    </div>
                    <div class="compliant-details-handeld-by">
                        <label class="applicationfont">Handeld By:</label>
                        <asp:DropDownList class="smallinputbox" runat="server" ID="ddl_compliant_details_handald_by" readonly="readonly" DataSourceID="ds_agents"
                            DataTextField="AgentName" DataValueField="AgentId" AppendDataBoundItems="true" />
                    </div>
                    <div class="compliant-details-rfc-sent">
                        <label class="applicationfont">RFC Sent:</label>
                        <div class="compliant-details-rfc-rb">
                            <asp:RadioButton runat="server" ID="rb_compliant_details_rfc_sent_yes" Text="Yes" CssClass="applicationfont" GroupName="rfcsent" />
                            <asp:RadioButton runat="server" ID="rb_compliant_details_rfc_sent_no" Text="No" CssClass="applicationfont" GroupName="rfcsent" />
                        </div>
                    </div>
                    <div class="compliant-details-accepted-by-client">
                        <label class="applicationfont">Accepted By Client:</label>
                        <div class="compliant-details-accepted-rb">
                            <asp:RadioButton runat="server" ID="rb_compliant_details_accepted_by_client_yes" Text="Yes" CssClass="applicationfont" />
                            <asp:RadioButton runat="server" ID="rb_compliant_details_accepted_by_client_no" Text="No" CssClass="applicationfont" />
                        </div>
                    </div>
                </InsertItemTemplate>
            </asp:FormView>
广播电台

您为什么不只在同一FormView上使用“编辑模板”?

  • 用户搜索。
  • FormView填充。
  • 用户可以按“编辑”,这会将表格模式更改为“编辑”。
  • 用户按下“提交”,然后将更改发送到数据库。

为什么有多个FormView?

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

使用NodeMCU ESP8266将Arduino数据发送到mySQL数据库

如何查看SPARK发送到我的数据库的SQL语句?

我已经通过CDN使用了CKEditor,但是无法将数据发送到数据库

我有问题使用laravel将多个用户ID发送到数据库中

我想将过滤后的数据从数据库发送到我的邮件中

CRUD-我无法将特定数据发送到数据库

使用Jquery / ajax将数据发送到数据库

无法将数据发送到mysql数据库。这不是我的PHP代码

使用EtherCard.h库将arduino数据发送到我的数据库

将XML数据发送到MySQL数据库

将textarea数据发送到数据库的麻烦

AJAX到PHP不会使用NODEJS将数据发送到数据库

如何使用Jquery和Ajax将Json数据发送到数据库中?

在使用jQuery将数据发送到数据库时,如何使按钮处于活动状态?

使用AJAX将数据发送到数据库失败

将数据发送到我的母版页

将下拉列表的信息发送到数据库

如何使用vue.js(ajax)将数据发送到数据库

无法使用Volley将数据发送到数据库

使用javaservlet将数据从数据库发送到jsp

将数据从表单发送到数据库

我想使用 ajax 或任何其他方法将图像发送到数据库

如何使用 PHP 将 HTML 输入字段发送到我的 MySQLi 数据库?

在我的前端保存主键以在发送到我的服务器进行一些数据库操作后使用它们是个好主意吗?

如何将数据从我的数据库发送到 Laravel 中的 google chart api

如何使用用户帐户从 Firebase 将数据发送到数据库?

将json数据发送到mysql数据库?

我正在尝试使用 laravel 将多个标题和多个文件发送到数据库中,但出现错误

Nodejs + mySQL 数据没有发送到我的数据库