Hi
The solution was useful and i have already tried with this solution.
In my gridview contains more than 12 columns ,I should able to view all columns in all devices(laptop,desktop,mobile)
with responsively . I agree your solution is one of the way. I need some other different ways to accompolish this.
and also I don't want to use horizontal and vertical scroll bar to view all the rows and column without scroll how to show all columns in all different devices
Here, I attached my code.In this code currently i am using horizontal scroll bar to read all the column.
1.what are all the way to show all columns and rows with responsive
2. same thing for Dev express grid also
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="griddemo.aspx.cs" Inherits="GridviewDemo.griddemo" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style>
.csspager td
{
padding-left:10px;
padding-right:10px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="overflow-x:auto; overflow-y:auto">
<asp:GridView ID="aspgrid" HeaderStyle-BackColor="#99ccff" HeaderStyle-ForeColor="White" Width="100%" OnInit="aspgrid_Init"
runat="server" PageSize="2" AllowPaging="true" OnPageIndexChanging="aspgrid_PageIndexChanging"
ShowHeader="true"
AutoGenerateColumns="false">
<RowStyle BackColor="#EFF3FB" />
<PagerStyle ForeColor="white" BackColor="#99ccff" CssClass="csspager" />
<HeaderStyle Font-Bold="True" ForeColor="White" HorizontalAlign="center" VerticalAlign="Bottom" />
<AlternatingRowStyle BackColor="white" />
<Columns>
<asp:BoundField DataField="ID" HeaderStyle-Width="5%" HeaderText="Id"/>
<asp:BoundField DataField="NAME" HeaderStyle-Width="5%" HeaderText="Name"/>
<asp:BoundField DataField="AGE" HeaderStyle-Width="5%" HeaderText="Age"/>
<asp:BoundField DataField="GENDER" HeaderStyle-Width="5%" HeaderText="Gender"/>
<asp:BoundField DataField="CITY" HeaderStyle-Width="5%" HeaderText="City"/>
<asp:BoundField DataField="FIRSTNAME" HeaderStyle-Width="5%" HeaderText="First Name"/>
<asp:BoundField DataField="LASTNAME" HeaderStyle-Width="5%" HeaderText="Last Name"/>
<asp:BoundField DataField="DATEOFBIRTH" HeaderStyle-Width="5%" HeaderText="Date Of Birth"/>
<asp:BoundField DataField="QUALIFICATION" HeaderStyle-Width="5%" HeaderText="Qualification"/>
<asp:BoundField DataField="PHONENUMBER" HeaderStyle-Width="5%" HeaderText="Phone Number"/>
<asp:BoundField DataField="STATENAME" HeaderStyle-Width="5%" HeaderText="State"/>
<asp:BoundField DataField="NATIONALITY" HeaderStyle-Width="5%" HeaderText="Nationality"/>
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace GridviewDemo
{
public partial class griddemo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
loadgrid();
}
}
private void loadgrid()
{
try
{
string connStr = ConfigurationManager.ConnectionStrings["DBConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
con.Open();
string query = "SELECT ID,NAME,GENDER,AGE,CITY,STATENAME,NATIONALITY,FIRSTNAME,LASTNAME,DATEOFBIRTH,QUALIFICATION,PHONENUMBER FROM SAMPLETABLE";
SqlCommand cmd = new SqlCommand(query, con);
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds);
con.Close();
aspgrid.DataSource = ds;
aspgrid.DataBind();
}
catch (Exception)
{
throw;
}
}
protected void aspgrid_Init(object sender, EventArgs e)
{
loadgrid();
}
protected void aspgrid_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
aspgrid.PageIndex = e.NewPageIndex;
loadgrid();
}
}
}
CREATE TABLE [dbo].[sampleTable](
[Id] [int] NULL,
[Name] [varchar](25) NULL,
[Gender] [varchar](10) NULL,
[age] [varchar](25) NULL,
[city] [varchar](25) NULL,
[StateName] [varchar](25) NULL,
[Nationality] [varchar](25) NULL,
[FirstName] [varchar](25) NULL,
[LastName] [varchar](25) NULL,
[DateOfBirth] [date] NULL,
[Qualification] [varchar](25) NULL,
[PhoneNumber] [int] NULL
) ON [PRIMARY]