在不使用数据库的情况下,在相同表单中单击提交按钮,在网格视图中创建Web表单并显示数 [英] create web form and display data in grid view on clicking submit button in same form without using database

查看:78
本文介绍了在不使用数据库的情况下,在相同表单中单击提交按钮,在网格视图中创建Web表单并显示数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请告诉我如何在没有数据库的情况下完成这项任务



以下是Employeeform.aspx文件



please tell me how to do this task without database

below is Employeeform.aspx file

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Employeeform.aspx.cs" Inherits="Employeeform" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <table border="0" cellpadding="0" cellspacing="0" width="100%">
        <tr>
            <td align="center">
                <h1>
                    Employee Form</h1>
            </td>
        </tr>
        <tr>
            <td>
            </td>
        </tr>
        <tr>
            <td align="center">
                <table border="0" cellpadding="0" cellspacing="0" width="40%">
                    <tr>
                        <td align="right">
                            <asp:Label ID="EmpNameLb" runat="server" Text="Employee Name"></asp:Label>
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtempName" runat="server"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <asp:Label ID="EmpAddLb" runat="server" Text="Employee address"></asp:Label>
                        </td>
                        <td align="left">
                            <asp:TextBox ID="txtempAdd" runat="server" TextMode="MultiLine"></asp:TextBox>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <asp:Label ID="genderLb" runat="server" Text="Gender"></asp:Label>
                        </td>
                        <td align="left">
                            <asp:RadioButtonList ID="RadioButtonList1" runat="server" RepeatDirection="Horizontal">
                                <asp:ListItem Value="1">Male</asp:ListItem>
                                <asp:ListItem Value="2">Female</asp:ListItem>
                            </asp:RadioButtonList>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <asp:Label ID="QualifnLb" runat="server" Text="Qualifaication"></asp:Label>
                        </td>
                        <td align="left">
                            <asp:DropDownList ID="DropDownList1" runat="server" Height="16px" Width="138px">
                                <asp:ListItem Value="0">Select</asp:ListItem>
                                <asp:ListItem Value="1">M.Tech</asp:ListItem>
                                <asp:ListItem Value="2">B.Tech</asp:ListItem>
                                <asp:ListItem Value="3">B.Sc</asp:ListItem>
                            </asp:DropDownList>
                        </td>
                    </tr>
                    <tr>
                        <td align="center" colspan="2">
                            <asp:Button ID="submitBtn" runat="server" Text="Submit" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
            </td>
        </tr>
        <tr>
            <td align="center">
                <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
                    <Columns>
                        <asp:BoundField HeaderText="EmpName" DataField="EmployeeName" />
                        <asp:BoundField HeaderText="EmpAddress" DataField="EmployeeAddress" />
                        <asp:BoundField HeaderText="Gender" DataField="Gender" />
                        <asp:BoundField HeaderText="Qualification" DataField="Qualification" />
                    </Columns>
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td>
            </td>
        </tr>
        <tr>
            <td>
            </td>
        </tr>
    </table>
    </form>
</body>
</html>

推荐答案

创建数据表并添加值并在按钮单击时将其绑定
create datatable and add value and bind it on button click


创建一个数据集或数据表,并在其中添加您的员工详细信息并将其绑定到您的网格。
create one dataset or data table and add your employee detail in that and bind that to your grid.


这篇关于在不使用数据库的情况下,在相同表单中单击提交按钮,在网格视图中创建Web表单并显示数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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