Responsive GridView for Mobile Phone, Tablet and Desktop display in ASP.Net
In order to make the GridView responsive,You can use Footable jQuery plugin which is compatible with Bootstrap design. To use Footable jQuery include the following code inside the form tag- <link href=”https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/css/footable.min.css” rel=”stylesheet” type=”text/css” /> <script type=”text/javascript” src=”http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js”></script> <script type=”text/javascript” src=”https://cdnjs.cloudflare.com/ajax/libs/jquery-footable/0.1.0/js/footable.min.js”></script> <script […]
Export data table to Excel Sheet(CSV) on Button Click
First You have to Create a grid view that will show details which you want to Export <asp:GridView ID=”GridView1″ CssClass=”footable” runat=”server” AutoGenerateColumns=”false” Style=”max-width: 500px” > <Columns> <asp:BoundField DataField=”Id” HeaderText=”Id” /> […]
Detect the device (Mobile/Desktop) in asp.Net
Create a page Desktop.aspx Add the following code in aspx page <asp:Label ID=”lblBrowser” runat=”server” Text = “Desktop” /> Add the following code in code behind(aspx.cs) protected void Page_Load(object sender, EventArgs e) { string userAgent = Request.ServerVariables[“HTTP_USER_AGENT”]; Regex OS = new Regex(@”(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino”, RegexOptions.IgnoreCase | RegexOptions.Multiline); Regex device […]