locked
Save record RRS feed

  • Question

  • User-1499457942 posted

    Hi

      I have below code . When user click on Add New Modal popup shows . I want when user clicks on Save , It should add record in Database

    <div class="row">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="x_title">
                    <h3>Maintain Categories </h3>
                    <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal" onclick="clearTextBox();">Add New</button><br /><br />
                </div>
                    <asp:ListView ID="lvwCategories" runat="server" 
                    OnItemEditing="lvwCategories_ItemEditing" 
                    onitemupdating="lvwCategories_ItemUpdating" 
                    onitemcanceling="lvwCategories_ItemCanceling">
                    <LayoutTemplate>
                        <table class="lamp" border="0"  cellpadding="0" cellspacing="0">
                            <tr>
                                <th>
                                    S.No.
                                </th>
                                <th>
                                    Code
                                </th>
                                <th>
                                    Description
                                </th>
                                <th colspan="2">
                                    Edit
                                </th>
                            </tr>
                            <tr id="itemplaceholder" runat="server">
                            </tr>
                        </table>
                    </LayoutTemplate>
                    <ItemTemplate>
                        <tr>
                            <td>
                                <%# Container.DataItemIndex + 1%>
                                <asp:HiddenField ID="hfId" runat="server" Value='<%#Eval("No") %>' />
                            </td>
                            <td>
                                <%#Eval("Code")%>
                            </td>
                            <td>
                                <%#Eval("Description")%>
                            </td>
                            <td colspan="2">
                                <asp:Button ID="btnEdit" runat="server" Text="Edit" CommandName="Edit" />
                            </td>
                        </tr>
                    </ItemTemplate>
                    <EditItemTemplate>
                        <tr>
                            <td>
                                <%# Container.DataItemIndex + 1%>
                                <asp:HiddenField ID="hfId" runat="server" Value='<%#Eval("No") %>' />
                            </td>
                            <td>
                                <asp:TextBox ID="txtDescription" runat="server" Text='<%#Eval("Description")%>'></asp:TextBox>
                                <asp:RequiredFieldValidator ID="rfv_txtEmployeeName" runat="server" ForeColor="Red"
                                    Font-Bold="true" Font-Size="18px" ToolTip="Please enter Description." ErrorMessage="*"
                                    ControlToValidate="txtDescription" ValidationGroup="vgEmployeeUpdate" Display="Dynamic"></asp:RequiredFieldValidator>
                            </td>
                            <td>
                                <asp:Button ID="btnUpdate" runat="server" Text="Update" CommandName="Update" CausesValidation="true"
                                    ValidationGroup="vgEmployeeUpdate" />
                            </td>
                            <td><asp:Button ID="btnCancel" runat="server" Text="Cancel" CommandName="Cancel" /></td>
                        
                        </tr>
                    </EditItemTemplate>
                </asp:ListView>
            </div>
            <div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            @*<button type="button" class="close" data-dissmiss="modal"><span aria-hidden="true">×</span></button>*@
                            <button type="button" class="close" data-dismiss="modal">×</button>
                            <h4 class="modal-title" id="H1">Add Store Category</h4>
                        </div>
                        <div class="modal-body">
                            <form>
                                <div class="form-group">
                                    <label for="Name">Description</label>
                                    <input type="text" class="form-control" id="Text2" placeholder="Description"/>
                                </div>
                            </form>
                        </div>
                        <div class="modal-footer">
                            <button type="button" class="btn btn-primary" id="Button1" onclick="return Add();">Add</button>
                            <button type="button" class="btn btn-primary" id="Button2" style="display:none;" onclick="Update();">Update</button>
                            <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                        </div>
                    </div>
                </div>       
            </div>
        </div>

    Thanks

    Wednesday, July 25, 2018 9:21 AM

All replies