мой дизайн передней панели такой
<form id="form1" runat="server" style="width: 1220px">
<div>
<asp:Button ID="add_user" runat="server" Text="Add User" OnClick="add_user_Click" />
<asp:Button ID="assign_role" runat="server" Text="Change User Role" OnClick="assgn_role_click"/><asp:Button ID="assign_menu" runat="server" Text="Assign Menu To User" OnClick="assgn_menu_click"/><asp:Button ID="manage_role" runat="server" Text="Manage New Role" OnClick="manage_new_role" /> <asp:TextBox ID="txtSearch" runat="server" placeholder="Enter User Name"></asp:TextBox>
<asp:Button ID="btn_search" class="btn btn-primary" Text="Search" runat="server" OnClick="Search"/>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="10"
OnRowCommand="GridView1_RowCommand" Width="990px" AllowPaging="true"
OnPageIndexChanging="OnPageIndexChanging" PageSize="38"
style="margin-right: 0px">
<Columns>
<asp:TemplateField HeaderText="ACTIONS">
<ItemTemplate>
<asp:Button ID="btnEdit" runat="server" Width="60" Text="Edit" CommandName="EditButton" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" OnClientClick="return confirm('Are you sure you want update?');" />
<asp:Button ID="brnDelete" runat="server" Width="60" Text="Delete" CommandName="DeleteButton" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" OnClientClick="return confirm('Are you sure you want delete?');" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="user_id" HeaderText="USER ID"/>
<asp:BoundField DataField="user_nm" HeaderText="USER NAME"/>
<asp:BoundField DataField="user_pass" HeaderText="USER PASSWORD"/>
<asp:BoundField DataField="role_nm" HeaderText="USER ROLE"/>
<asp:BoundField DataField="user_mode" HeaderText="USER MODE"/>
</Columns>
</asp:GridView>
</div>
</form>
теперь для отображения данных в этой сетке я написал код, как показано ниже,
protected void ShowData()
{
dt = new DataTable();
con = new SqlConnection(cs);
con.Open();
adapt = new SqlDataAdapter("SELECT user_id, user_nm, user_pass, role_nm, user_mode FROM users ORDER BY user_nm", con);
adapt.Fill(dt);
if (dt.Rows.Count > 0)
{
GridView1.DataSource = dt;
GridView1.DataBind();
}
con.Close();
}
выше возвращает результат в порядке, но он не будет выполняйте заказ по работе в сети, пожалуйста, помогите мне.